본문 바로가기
개발/ALGOLIA

알고리아 Managing Results(3-7)

by dev_caleb 2022. 3. 3.
728x90

Create Custom Ranking Attributes

https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/configure-custom-ranking/

 

Algolia offers good relevance out-of-the-box. Yet, what makes search great is fine-tuning it according to business relevance. For example, imagine you’re developing an app based on Twitter feeds. When searching, you want to rank results by relevance and the custom attributes likes and retweets.

알골리아는 즉시 좋은 관련성을 제공한다. 그러나 검색을 훌륭하게 만드는 것은 비즈니스 관련성에 따라 검색을 미세 조정하는 것입니다. 예를 들어, 당신이 트위터 피드를 기반으로 앱을 개발한다고 상상해 보세요. 검색할 때 관련성 및 사용자 지정 특성(좋아요 및 리트윗)을 기준으로 결과의 순위를 매기려고 합니다.

You can do this by using Algolia’s custom ranking feature to specify what attributes to rank on. You can configure these attributes at indexing time with the customRanking parameter or through Algolia’s dashboard.

이 작업은 Algolia의 사용자 지정 순위 지정 기능을 사용하여 순위를 지정할 특성을 지정할 수 있습니다. 인덱싱 시 customParting 매개 변수를 사용하거나 Algolia의 대시보드를 통해 이러한 속성을 구성할 수 있습니다.

Dataset example#

In this example, you’re developing an app based on Twitter feeds and want to rank tweets by the number of likes and retweets. Here’s what the dataset would look like:

이 예에서는 트위터 피드를 기반으로 앱을 개발하고 있으며 좋아요와 리트윗 수에 따라 트윗의 순위를 매기려고 합니다. 데이터 세트의 모양은 다음과 같습니다.

[
  {
    "tweet": "🎈 We're introducing Create InstantSearch App today: a CLI to bootstrap InstantSearch apps from the terminal. Read more in this blog post by @FrancoisChlfr!",
    "retweets": 13,
    "likes": 27
  },
  {
    "tweet": "Designers from all horizons, don't forget to register for next #ParisDesignMeetup, taking place on Sept 25th!",
    "retweets": 9,
    "likes": 13
  },
  {
    "tweet": "Are you ready for GSA to be a thing of the past? Register now for our webinar, where we'll help you with migration options, tips, and tricks to make your move as painless as possible. https://go.algolia.com/gsa-migration",
    "retweets": 4,
    "likes": 6
  }
]

 

Using the API

To rank on retweets and likes, you first need to set customRanking during indexing time. You can set custom ranking criteria to be in ascending or descending order.

리트윗 등을 기준으로 순위를 매기려면 먼저 인덱싱 시간 동안 customRanking을 설정해야 합니다. 사용자 지정 순위 기준을 오름차순 또는 내림차순으로 설정할 수 있습니다.

 

index.setSettings({
  customRanking: [
    'desc(retweets)',
    'desc(likes)'
  ]
}).then(() => {
  // done
});

Custom ranking criteria are applied in order (in this example, first retweets and then likes).

사용자 지정 순위 기준은 순서대로 적용됩니다(이 예에서는 먼저 리트윗한 다음 좋아요).

 

 

Using the dashboard

You can also set your custom ranking in your Algolia dashboard.

또한 Algolia 대시보드에서 사용자 지정 순위를 설정할 수 있습니다.

  1. Select the Search product icon on your dashboard.
  2. On the Index page, select your index.
  3. Click the Ranking tab.
  4. In the Ranking Formula & Custom Ranking section, select attributes “retweets” then “likes” in the Add a Custom Ranking Attribute dropdown.
  5. Don’t forget to save your changes.

1. 대시보드에서 제품 검색 아이콘을 선택합니다.
2. 인덱스 페이지에서 인덱스를 선택합니다.
3. Ranking 탭을 클릭합니다.
4. [랭킹 공식] & [사용자 정의 랭킹 특성 추가] 드롭다운에서 "리셋" 특성을 선택한 후 "좋아요"를 선택합니다.
5. 변경 사항을 저장하는 것을 잊지 마십시오.

 

Custom ranking on different attributes

Custom ranking applies at the index level. This means records that don’t have an attribute that’s in the customRanking list are pushed to the bottom. For example, say you want to add Facebook posts to your dataset, and they have attributes likes and comments. Because retweets are a custom ranking attribute, and Facebook posts don’t have a retweets attribute, they’re unlikely to win the tie-break against a tweet.

You could solve this by creating a computed attribute. For example, you could compute a single popularity attribute instead of having likes and retweets on one side and likes and commentson the other.

사용자 지정 순위는 인덱스 수준에서 적용됩니다. 즉, customParting 목록에 없는 속성이 없는 레코드는 맨 아래로 푸시됩니다. 예를 들어, 데이터 세트에 Facebook 게시물을 추가하고 싶은데, 해당 게시물에 좋아요와 댓글 특성이 있다고 가정해 보십시오. 리트윗은 사용자 지정 순위 속성이고, 페이스북 게시물에는 리트윗 속성이 없기 때문에 트윗에 대한 타이브레이크를 이길 가능성은 낮다.
이 문제는 계산된 특성을 만들어 해결할 수 있습니다. 예를 들어, 한쪽에는 좋아요와 리트윗을, 다른 한쪽에는 좋아요와 주석을 붙이는 대신 하나의 인기 특성을 계산할 수 있습니다.

Computed attributes(계산된 특성)

You might want to create a custom ranking attribute based on the calculated value of other attributes. In other words, a computed attribute. For example:

다른 특성의 계산된 값을 기반으로 사용자 지정 순위 특성을 생성할 수 있습니다. 즉, 계산된 속성입니다. 예:

  • A Bayesian average of product ratings
  • A simple, combined score of other attributes (such as popularity being the sum of likesand retweets).
  • A boolean value set to true or false based on whether another attribute is null.

-제품 등급의 베이지안 평균
-기타 속성의 단순하고 결합된 점수(예: 인기도는 좋아요와 리트윗의 합).
-다른 특성이 null인지 여부에 따라 true 또는 false로 설정된 부울 값입니다.

 

 

To implement a computed attribute, you must create it as an attribute in your records. To populate the record with values for the computed attribute:

계산된 특성을 구현하려면 레코드에서 속성을 속성으로 만들어야 합니다. 레코드를 계산된 특성의 값으로 채우는 방법

  1. Retrieve every record in the index, using the browse method.
  2. For each record, calculate the computed attribute value.
  3. Update each record’s computed attribute in the index with the calculated value, using the partialUpdateObjects method.

-찾아보기 방법을 사용하여 인덱스의 모든 레코드를 검색합니다.
-각 레코드에 대해 계산된 속성 값을 계산합니다.
-partialUpdateObjects 방법을 사용하여 인덱스에 있는 각 레코드의 계산 특성을 계산된 값으로 업데이트합니다.

 

The regularity of these updates depends on your use case: it might be once a month, every week, daily, or even more frequently.

이러한 업데이트의 주기는 사용 사례에 따라 달라지며, 한 달에 한 번, 매주, 매일 또는 그 이상일 수 있습니다.

Metric types

The custom ranking field accepts any numerical or boolean value that represents the relative relevance of your records.

The attribute type can be a raw value like the number of sales, views, or likes. The field can also be a computed value such as a popularity score that you calculated before adding the record to Algolia.

What you set as your customRanking depends on your use case and what data you have available. Some retail metrics commonly used in customRanking include sales rank, stock levels, free shipping (boolean), on sale (boolean), and rating. Publish date (as a timestamp), page views, and likes are often used in media applications.

사용자 지정 순위 필드에는 레코드의 상대적인 관련성을 나타내는 숫자 또는 부울 값을 사용할 수 있습니다.
특성 유형은 판매 수, 뷰 수 또는 좋아요 수와 같은 원시 값이 될 수 있습니다. 이 필드는 기록을 알골리아에 추가하기 전에 계산한 인기 점수와 같은 계산된 값이 될 수도 있습니다.
customRanking으로 설정하는 내용은 사용 사례 및 사용 가능한 데이터에 따라 다릅니다. 커스텀 랭킹에서 일반적으로 사용되는 소매 지표에는 판매 순위, 재고 수준, 무료 배송(부울), 판매(부울) 및 등급이 포함됩니다. 게시 날짜(타임스탬프), 페이지 보기 등은 미디어 응용 프로그램에서 자주 사용됩니다.

 

Check that the numeric attributes used in customRanking aren’t formatted as a string, as this would cause the records to be ranked alphabetically.

 

customRanking에 사용되는 숫자 특성이 문자열 형식으로 되어 있지 않은지 확인합니다. 이렇게 하면 레코드가 알파벳 순으로 순위가 매겨집니다.

String and null or absent values

If a custom ranking attribute is missing from a record or has a null value, that record is always ordered last, regardless of its ascending or descending setting. Records with null or missing values are considered equal.

Strings are sorted after numbers and before null or absent values. Strings are also compared by lexicographical order.

레코드에 사용자 지정 순위 특성이 없거나 null 값이 있는 경우 해당 레코드는 오름차순 또는 내림차순 설정에 관계없이 항상 마지막에 정렬됩니다. null 값 또는 결측값이 있는 레코드는 동일한 것으로 간주됩니다.
문자열은 숫자 뒤와 null 값 또는 부재 값 앞에 정렬됩니다. 문자열은 사전순으로 비교되기도 한다.

 

 

728x90

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

알고리아 Managing Results(3-9)  (0) 2022.03.03
알고리아 Managing Results(3-8)  (0) 2022.03.03
알고리아 Managing Results(3-6)  (0) 2022.03.03
알고리아 Managing Results(3-5)  (0) 2022.03.03
알고리아 Managing Results(3-4)  (0) 2022.03.03