본문 바로가기
개발/ALGOLIA

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

by dev_caleb 2022. 3. 1.
728x90

Different Synchronization Strategies(다양한 동기화 전략)

https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/in-depth/the-different-synchronization-strategies/

 

Different synchronization strategies | Algolia

Learn about the different ways to reindex your data into Algolia whenever your content changes.

www.algolia.com

 

Once you’ve first indexed your data, you need to keep your index up to date as the data changes. Most of the time, you need to reindex in the following scenarios:

  • You’ve changed your index’s structure.
  • Your source has changed since the last update.
  • You need to resolve “data drift” which happens when you have different sources of data, making it difficult to track changes.

데이터를 처음 인덱싱한 후에는 데이터가 변경될 때 인덱스를 최신 상태로 유지해야 합니다. 대부분의 경우 다음과 같은 시나리오에서 다시 인덱싱해야 합니다.
-인덱스 구조가 변경되었습니다.
-마지막 업데이트 이후 소스가 변경되었습니다.
-데이터 소스가 달라 변경 사항을 추적하기 어려울 때 발생하는 "데이터 드리프트"를 해결해야 합니다.

 

 

There are several ways to update your index:

  1. Full reindexing: replace your entire index with a new set of records.
  2. Full record updates: replace an entire record with a new one.
  3. Partial record updates: update only a subset of attributes within a record.

인덱스를 업데이트하는 여러 가지 방법은 다음과 같습니다.
1. 전체 다시 인덱싱: 전체 인덱스를 새 레코드 세트로 바꿉니다.
2. 전체 레코드 업데이트: 전체 레코드를 새 레코드로 바꿉니다.
3. 부분 레코드 업데이트: 레코드 내의 특성 하위 집합만 업데이트합니다.

 

The appropriate method depends on your use case.

사용 사례에 따라 적절한 방법이 달라집니다.

 

 

 

Differences between each method(각 메소드의 차이)

Algolia offers three methods to change the content of your index. It’s important to understand their differences so you can better manage your updates.

알골리아는 인덱스의 내용을 변경할 수 있는 세 가지 방법을 제공합니다. 업데이트를 보다 효과적으로 관리할 수 있도록 이러한 차이점을 이해하는 것이 중요합니다.

 

Full reindexing

When performing a full reindex, you’re removing all existing records and replacing them with a fresh set. This is ideal when your data changes a lot or when there’s no way for you to track it.

For example, if you have a content site that constantly changes, such as technical documentation, you should split long pages into multiple records for relevance reasons. This makes tracking changes difficult, because adding a single sentence in the middle of a page can shift the entire record structure. Also, depending on the structure of the site and how you update it, it might be impossible to know what exact pages were impacted. It’s a typical scenario where full reindexing is necessary.

To fully reindex your data, you need to use the replaceAllObjects method. This ensures there’s no downtime during the reindex, and your search is always available.

 

전체 재색인을 수행할 때 기존 레코드를 모두 제거하고 새 세트로 바꿉니다. 이는 데이터가 많이 변경되거나 추적할 방법이 없을 때 이상적입니다.
예를 들어 기술 문서와 같이 지속적으로 변경되는 컨텐츠 사이트가 있는 경우 관련성을 이유로 긴 페이지를 여러 레코드로 분할해야 합니다. 페이지 중간에 한 문장을 추가하면 전체 레코드 구조가 바뀔 수 있기 때문에 변경 내용을 추적하기가 어렵습니다. 또한 사이트의 구조와 업데이트 방법에 따라 어떤 페이지가 영향을 받았는지 정확히 알 수 없을 수도 있습니다. 완전한 재인덱싱이 필요한 전형적인 시나리오입니다.
데이터를 완전히 다시 인덱싱하려면 replaceAllObjects 방법을 사용해야 합니다. 이렇게 하면 재색인 중에 다운타임이 발생하지 않고 검색이 항상 가능합니다.

 

A full reindex can significantly increase your indexing operations count. It’s also slower than incremental updates, because you’re reindexing every single record. This is a powerful way of keeping your data up to date, but be mindful of the impact on your operations count and indexing pipeline.

전체 재색인을 수행하면 인덱싱 작업 수가 크게 늘어날 수 있습니다. 또한 모든 레코드를 다시 인덱싱하기 때문에 증분 업데이트보다 속도가 느립니다. 이 방법은 데이터를 최신 상태로 유지하는 강력한 방법이지만 작업 수와 인덱싱 파이프라인에 미치는 영향을 염두에 두십시오.

Full record updates

If you can track changes to your data and are able to identify affected records, then you can update records individually.

For example, imagine you’re running a forum with a search to look for members. Your records have a one to one relationship with member entities in your data. In this scenario, you can update each record whenever the entity changes. Whenever you add, update, or delete a member, you could also perform an incremental update to your Algolia index.

To update a record, you need to use the saveObjects method and specify the objectID of the record to update.

데이터의 변경 사항을 추적하고 영향을 받는 레코드를 식별할 수 있는 경우 레코드를 개별적으로 업데이트할 수 있습니다.
예를 들어, 구성원을 찾기 위해 검색과 함께 포럼을 운영하고 있다고 가정해 보십시오. 레코드는 데이터의 구성원 엔티티와 일대일 관계를 가집니다. 이 시나리오에서는 도면요소가 변경될 때마다 각 레코드를 업데이트할 수 있습니다. 구성원을 추가, 업데이트 또는 삭제할 때마다 Algolia 색인에 대한 증분 업데이트를 수행할 수도 있습니다.
레코드를 업데이트하려면 saveObjects 방법을 사용하고 객체를 지정해야 합니다.업데이트할 레코드의 ID입니다.

Partial record updates#

Full record updates work when you’re able to specify the full data to put in the record. Yet, there are cases when you only know the part of the data to update, and not the rest of the data. In those situations, you can perform partial record updates with only the data to change.

Imagine you have an online store with independent systems handling different aspects of your data, one for content management and a third-party service for customer reviews. Whenever a product’s description changes, your CMS doesn’t know how many reviews the product has. Conversely, whenever a customer posts a review, the API of your third-party service can only provide you with this data. In this case, you would probably want to centralize update events and perform partial record updates based on the data you receive.

To update individual attributes in a record, you need to use the partialUpdateObjects method.

전체 레코드 업데이트는 레코드에 넣을 전체 데이터를 지정할 수 있을 때 작동합니다. 다만 업데이트해야 할 데이터의 일부만 알고 나머지 데이터는 모르는 경우가 있습니다. 이러한 상황에서는 변경할 데이터만 사용하여 부분 레코드 업데이트를 수행할 수 있습니다.
컨텐츠 관리를 위한 온라인 상점과 고객 리뷰를 위한 타사 서비스 등 데이터의 다양한 측면을 처리하는 독립적인 시스템을 갖춘 온라인 상점이 있다고 가정해 보십시오. 제품 설명이 변경될 때마다 CMS는 제품의 리뷰 수를 알 수 없습니다. 반대로 고객이 리뷰를 올릴 때마다 타사 서비스의 API는 이 데이터만 제공할 수 있습니다. 이 경우 수신한 데이터에 따라 업데이트 이벤트를 중앙 집중화하고 부분 레코드 업데이트를 수행할 수 있습니다.
레코드에서 개별 특성을 업데이트하려면 partialUpdateObjects 메서드를 사용해야 합니다.

 

 

 

728x90