본문 바로가기
개발/ALGOLIA

알고리아 Managing Results(3-14)

by dev_caleb 2022. 3. 4.
728x90

Sort an Index Alphabetically

https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/sort-an-index-alphabetically/

 

Sort an index alphabetically | Algolia

How to sort your records in alphabetical order.

www.algolia.com

 

Having constantly seen data sorted alphabetically, you may find yourself wanting to follow suit. However, while sorting alphabetically makes sense for a database, it doesn’t for a search engine and we strongly discourage it. This isn’t to say your use case is invalid; rather, we want to encourage caution and due consideration.

알파벳 순으로 정렬된 데이터를 계속 보게 되면 따라 하고 싶은 자신을 발견할 수 있습니다. 그러나 데이터베이스에서는 알파벳 순으로 정렬하는 것이 타당하지만 검색 엔진에서는 적합하지 않으므로 우리는 이 작업을 강력히 쓰지 않는 것을 권장합니다. 이는 귀하의 사용 사례가 무효라는 것이 아니라 주의와 적절한 고려를 권장하는 바입니다.

 

When you sort your data alphabetically, you don’t only devalue Algolia’s tie-breaking algorithm: you essentially disable it. If you sort alphabetically first, then the only objects requiring tie-breaking are those with the exact same name: there will likely be few objects that fit this criterea.

데이터를 알파벳 순으로 정렬하면 알골리아의 연결 해제 알고리즘을 평가절하할 뿐만 아니라 본질적으로 비활성화합니다. 알파벳 순으로 정렬할 경우 동일한 이름을 가진 객체만 묶어야 합니다. 이 문자에 맞는 객체가 거의 없습니다.

 

Alphabetically structured results lead users to search through data by hand, while a search engine, like Algolia, should ensure that they don’t need to.

알파벳 순으로 구성된 결과는 사용자가 데이터를 손으로 검색하도록 유도하는 반면, Algolia와 같은 검색 엔진은 사용자가 데이터를 검색할 필요가 없도록 해야 한다.

 

Since sorting your data alphabetically disables Algolia’s tie-breaking, it’s best to give users this type of sort as an option and not as the default experience. To provide different sorting options, you should use replica indices.

 

데이터를 알파벳 순으로 정렬하면 Algolia의 타이브레이킹이 비활성화되므로 사용자에게 이러한 정렬 유형을 기본 경험으로 제공하지 않고 옵션으로 제공하는 것이 가장 좋습니다. 다른 정렬 선택사항을 제공하려면 복제본 색인을 사용해야 합니다.

 

Warnings aside, it’s still possible to sort alphabetically by using the customRanking parameter with the attribute you want to sort on. If you are sorting alphabetically on a non-replica index, the method is the same as for a standard replica.

경고 외에도 정렬하려는 속성이 있는 customParting 매개 변수를 사용하여 알파벳 순으로 정렬할 수 있습니다. 비복제 색인에서 알파벳 순으로 정렬하는 경우, 방법은 표준 복제본과 동일합니다.

 

 

Using the API#

Standard replicas#

To sort a standard replica or non-replica index alphabetically, you need to change its custom ranking, and set custom as the index’s first ranking criterion.

표준 복제본 또는 비복제 인덱스를 알파벳 순으로 정렬하려면 사용자 정의 순위를 변경하고 사용자 정의를 인덱스의 첫 번째 순위 기준으로 설정해야 합니다.

 

index.setSettings({
  customRanking: [
    'asc(textual_attribute)'
  ],
  ranking: [
    'custom',
    'typo',
    'geo',
    'words',
    'filters',
    'proximity',
    'attribute',
    'exact'
  ]
}).then(() => {
  // done
});

 

 

Virtual replicas

If you would like to use virtual replicas for a strict alphabetical sort where other relevancy factors aren’t taken into account, you must set relevancyStrictness to 0. You must also set the replica’s custom ranking with the attributes you’d like to sort on

다른 관련 요소를 고려하지 않은 엄격한 알파벳 정렬에 가상 복제본을 사용하려면, relevancyStrictness을 0으로 설정해야 합니다. 또한 정렬할 속성으로 복제본의 custom ranking를 설정해야 합니다.

index.setSettings({
  customRanking: [
    'asc(textual_attribute)'
  ],
  'relevancyStrictness': 0
}).then(() => {
  // done
});

 

Caveats#

Algolia isn’t locale-aware. Strings are ordered by the lexicographical order of their first 50 Unicode characters. That may be acceptable for English text, less so for other languages (especially those with diacritics).

알골리아는 위치를 몰라 문자열은 처음 50개의 유니코드 문자를 사전순으로 정렬한다. 이것은 영어 텍스트에서는 허용될 수 있지만 다른 언어(특히 분음 부호가 있는 언어)에서는 허용되지 않습니다.

 

728x90

'개발 > ALGOLIA' 카테고리의 다른 글

알고리아 Managing Results(3-16)  (0) 2022.03.04
알고리아 Managing Results(3-15)  (0) 2022.03.04
알고리아 Managing Results(3-13)  (0) 2022.03.04
알고리아 Managing Results(3-12)  (0) 2022.03.03
알고리아 Managing Results(3-11)  (0) 2022.03.03