본문 바로가기
개발/ALGOLIA

알고리아 Managing Results(3-19)

by dev_caleb 2022. 3. 4.
728x90

Manage Multiple Indices(다수의 index 관리하기)

https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/set-settings-and-forward-to-replicas/

 

Manage multiple indices | Algolia

Copying index settings to replicas and other indices.

www.algolia.com

 

 

It’s common to have several replica indices that differ from their primary index by a single setting, such as the sorting strategy. Products in an ecommerce store are a good example. You may have a primary index sorted by ascending price, and one or more replicas that sort products by descending price, descending popularity, descending rating, etc.

Despite these different sorting settings, you may still want to copy settings from one index to its replicas or other indices. For example, if you decide to change the searchableAttributes setting, you probably want it to apply to all indices.

The forwardToReplicas parameter allows you to forward new settings to replicas. From there, you can change only the settings that need to be different and keep all others synchronized.

정렬 전략과 같이 하나의 설정으로 기본 인덱스와 다른 여러 복제본 인덱스를 갖는 것이 일반적입니다. 전자상거래 상점의 상품들이 좋은 예이다. 오름차순 정렬된 기본 색인과 내림차순 가격, 내림차순 인기, 내림차순 등에 따라 제품을 정렬하는 하나 이상의 복제본이 있을 수 있습니다.
이렇게 다른 정렬 설정에도 불구하고, 한 색인의 설정을 복제본 또는 다른 색인으로 복사할 수 있습니다. 예를 들어, searchableAttributes 설정을 변경할 경우 모든 인덱스에 적용하려는 경우가 많습니다.
ForwardToReplicas 매개변수를 사용하여 복제본에 새 설정을 전달할 수 있습니다. 여기서 서로 달라야 하는 설정만 변경하고 다른 모든 설정은 동기화 상태로 유지할 수 있습니다.

 

 

 

Example of multiple indices#

You have a primary index called products and a products_price_desc replica. Both indices have the same data and settings, apart from the ranking setting.

If you want to change the searchableAttributes setting to include a new description attribute for all indices, primary and replicas, use the forwardToReplicas parameter.

products라는 기본 인덱스와 products_price_desc 복제본이 있습니다. 두 지수 모두 순위 설정과 별개로 데이터와 설정이 동일합니다.
모든 색인, 주 색인 및 복제본에 대한 새 설명 속성을 포함하도록 searchableAttributes 설정을 변경하려면 ForwardToReplicas 매개 변수를 사용하십시오.

Using the API#

The setSettings method, along with all synonyms and Rules methods, have a forwardToReplicasparameter. By default, forwardToReplicas is false, so any setting, synonym, or Rule change only applies to the target index. By setting it to true, you can forward these changes to all the replicas belonging to the index you target.

setSettings 메서드는 모든 동의어 및 규칙 메서드와 함께 ForwardToReplicas 매개 변수를 가집니다. 기본적으로 ForwardToReplicas는 거짓이므로 모든 설정, 동의어 또는 규칙 변경사항은 대상 색인에만 적용됩니다. true로 설정하면 대상 색인에 속하는 모든 복제본에 변경사항을 전달할 수 있습니다.

 

index.setSettings({
  'searchableAttributes': ['name', 'description']
}, {
  forwardToReplicas: true
}).then(() => {
  // done
});

 

Settings are only forwarded to existing replicas. If you want to forward settings and create a replica, you first have to create the replica and forward the settings after. These must be separate operations.

 

 

설정은 기존 복제본에만 전달됩니다. 설정을 보내고 복제본을 작성하려면, 먼저 복제본을 작성한 후 설정을 보내야 합니다. 이 작업은 별도의 작업이어야 합니다.

 

 

Using the dashboard#

Whenever you make settings changes, Algolia’s dashboard will prompt you to review them before saving and gives you the option to Copy these settings to other indices and/or replicas.

Whenever you copy settings changes to indices, you replace the previous setting on the index.For example, if you change the ranking formula on the primary index to include a sort on an inventory attribute, and then choose to copy the updated ranking setting to all replicas, you overwrite any previously set sorts on other attributes on the replicas.

When altering the ranking formula on indices with replicas, you are recommended to do it on a per index basis.

While customRanking is part of the ranking formula, it’s a setting as well. You can alter the custom ranking and forward the change to your replicas without worrying about overwriting the entire ranking formula.

You usually don’t need to worry about overwriting settings, since you typically want most settings to be the same between replicas. Notable exceptions include ranking and typoTolerance.

설정을 변경할 때마다 Algolia의 대시보드는 저장하기 전에 해당 설정을 검토하라는 메시지를 표시하고 이러한 설정을 다른 인덱스 및/또는 복제본에 복사할 수 있는 옵션을 제공합니다.
설정 변경사항을 인덱스에 복사할 때마다 인덱스의 이전 설정을 바꿉니다.예를 들어, 기본 색인에서 인벤토리 속성의 정렬을 포함하도록 순위 수식을 변경한 후 업데이트된 순위 설정을 모든 복제본에 복사하도록 선택할 경우, 복제본의 다른 속성에 대해 이전에 설정된 정렬을 덮어씁니다.
복제본이 있는 색인에서 순위 수식을 변경할 때 색인별로 순위 수식을 변경하는 것이 좋습니다.
customParting은 순위 계산식의 일부이지만 설정이기도 합니다. 전체 순위 수식을 덮어쓸 염려 없이 사용자 정의 순위를 변경하고 변경사항을 복제본에 전달할 수 있습니다.
일반적으로 복제본 간에 대부분의 설정이 동일하기를 원하므로 설정을 덮어쓸 필요가 없습니다. 주목할 만한 예외로는 순위 및 typoTolerance가 있습니다.

 

 

Copy synonyms and Rules

The dashboard also allows you to batch import and export synonyms and Rules with a configuration file.

 

또한 대시보드를 사용하여 구성 파일과 함께 동의어 및 규칙을 일괄적으로 가져오고 내보낼 수 있습니다.

 

728x90

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

알고리아 Managing Results(3-21)  (0) 2022.03.04
알고리아 Managing Results(3-20)  (0) 2022.03.04
알고리아 Managing Results(3-18)  (0) 2022.03.04
알고리아 Managing Results(3-17)  (0) 2022.03.04
알고리아 Managing Results(3-16)  (0) 2022.03.04