본문 바로가기
개발/ALGOLIA

알고리아 Sending And Managing Data(2-3)

by dev_caleb 2022. 2. 28.
728x90

Creating and Using Nested Attributes(Nested Attributes 생성과 사용)

What are nested attributes? 내포 속성은 뭘까?

Nested attributes are a way of applying sub-categories to your attributes. For instance, instead of having a single searchable attribute price, you may set up some sub-categories: price.net, price.gross, price.margin (note the use of ‘dot notation’ here to separate the parent attribute from its child).

내포 특성은 속성에 하위 카테고리를 적용하는 방법입니다. 예를 들어, 검색 가능한 단일 특성 가격을 갖는 대신 일부 하위 범주를 설정할 수 있습니다. price.net, price.gross, price.margin입니다(여기서 상위 특성과 하위 속성을 구분하는 '도트 표기법' 사용).

How to create nested attributes(내포속성 만들기)

You can create nested attributes by adding a JSON object to your records when you send your records to Algolia. For example: 내포속성은 알고리아로 레코드를 보낼 때 json object에 너의 레코드를 추가함으로써 만들수 있다. 예를 들어 : 

 

Where you can use nested attributes(내포 속성을 사용할 수 있는 위치)

You can use nested attributes wherever you might use a regular attribute, such as searchableAttributes and attributesForFaceting. Just make sure you use the appropriate dot notation (for example, authors.mainAuthor) to refer to them.

You can’t add nested attributes to searchableAttributes in the dashboard, you must use the setSettings method on an API client to define them.

There are no limitations on the number of nested attributes apart from the default restrictions on record size. There are also no limits on the depth of your nesting: you could use something like price.net.england.yorkshire.

searchableAttributes 및 attributesForFaceting과 같은 일반 속성을 사용할 수 있는 모든 곳에서 중첩 특성을 사용할 수 있습니다. 적절한 점 표기법(예: writers.main)을 사용해야 합니다.(작성자)를 참조합니다.
대시보드의 searchableAttributes에 중첩 속성을 추가할 수 없습니다. API 클라이언트에서 setSettings 메서드를 사용하여 중첩 속성을 정의해야 합니다.
레코드 크기에 대한 기본 제한 이외에 중첩 특성 수에는 제한이 없습니다. 또한 둥지 깊이에 대한 제한은 없습니다. 요크셔의 price.net.hbs와 같은 것을 사용할 수 있습니다.

Reducing Record Size(레코드 사이즈 줄이기)

Algolia limits the size of a record for performance reasons. The limits depend on your plan. If a record is larger than the threshold, Algolia returns the error message Record is too big. Besides upgrading your plan, there are techniques that can help you reformat and break your records into smaller ones, depending on your use case.

If you need to index long documents, you should split your data into several records rather than indexing a full document in one record. Please visit the how-to guide on indexing long documents.

If your records have lots of attributes, there are probably some you don’t use, or could optimize by reformatting how you structure the data.

알고리아는 성능상의 이유로 레코드 사이즈를 제한한다. 제한 수는 당신의 plan에 따라 다르다. 만약 레코드가 임계값보다 크면 Algolia는 "Record is too bigger" 오류 메시지를 반환합니다. 요금제를 업그레이드하는 것 외에도 사용 사례에 따라 레코드를 더 작은 크기로 다시 포맷하고 분할하는 데 도움이 되는 기술이 있습니다.
긴 문서를 색인화해야 하는 경우, 하나의 레코드에서 전체 문서를 색인화하는 대신 데이터를 여러 레코드로 분할해야 합니다. 긴 문서 색인 작성 방법 가이드를 방문하십시오.
레코드에 속성이 많은 경우 사용하지 않는 속성이 있을 수도 있고 데이터 구조 방식을 다시 포맷하여 최적화할 수도 있습니다.

 

Removing unused attributes(사용하지 않는 속성 제거)

You might not need to index every attribute from your data source into Algolia. You should rework your raw data before indexing records to Algolia and remove what you don’t need. For example, imagine you’re developing a website to display tweets on specific topics. Twitter may send you a lot of metadata, most of which might be useless in the context of search.

알골리아의 데이터 소스의 모든 속성을 index할 필요는 없다. 너는 

 

Before removing attributes(속성을 지우기 전)

For example, an excerpt of the API response for a single tweet might look like this:예를 들어 단일 트윗에 대한 API 응답의 발췌문은 다음과 같을 수 있습니다.

 

Indexing everything would grow your record’s size, while you might not need everything to build your search experience. Furthermore, you could reuse the same attributes for different purposes. Instead of making a test on the pictures attribute to show a gallery conditionally, you could include the pictures_urls attribute only when the array isn’t empty, and perform the same test on the presence of that attribute.

모든 항목을 인덱싱하면 레코드 크기가 커지지만 검색 환경을 구축하는 데 모든 항목이 필요하지 않을 수 있습니다. 게다가 동일한 속성을 다른 용도로 재사용할 수 있습니다. 갤러리를 조건부로 표시하기 위해 그림 특성에 대한 테스트를 수행하는 대신 배열이 비어 있지 않은 경우에만 pictures_urls 특성을 포함하고 해당 특성이 있는 경우에도 동일한 테스트를 수행할 수 있습니다.

 

After removing attributes(속성을 지운 후)

You can cherry-pick only the information you need for searching, displaying, ranking, and leaving everything else out. After transforming the data, a record could look like this:

 

Before reworking the data, you had information that would bloat your record without helping with either searching, displaying, or ranking. After selecting only the necessary data, you’ve reduced the number of attributes and the record size without hurting search quality.

검색, 표시, 순위 지정, 기타 모든 항목 제외에 필요한 정보만 체리픽할 수 있습니다. 데이터를 변환한 후 레코드는 다음과 같을 수 있습니다.
데이터를 다시 작업하기 전에 검색, 표시 또는 순위 지정에 도움이 되지 않고 레코드를 부풀릴 수 있는 정보가 있었습니다. 필요한 데이터만 선택한 후 검색 품질 저하 없이 속성 수와 레코드 크기를 줄일 수 있습니다.

 

728x90