알고리아 Sending And Managing Data(2-7)
Choosing Between One or More Indices(1개 또는 그 이상의 인덱스 선택하기)
Algolia lets you put all your records into a single index, or spread them across several indices. By default, you can create up to 1,000 indices.
알고리아는 너의 레코드들을 싱글 index 또는 여러개의 index에 나누어 저장할 수 있도록 해준다. 기본적으로 너는 1,000개의 index를 저장할 수 있다.
Federated search(연합 검색)
Multiple indices are appropriate when you have different kinds of data to index, such as movies, actors, etc. They’re also useful to provide different ranking strategies for the same data, such as most recent movies or highest rated movies. Regardless, how you organize your indices corresponds to how you want to search and display your records.
Imagine a website that has a search experience for movies, and another one for actors. When searching for a movie, you may want to retrieve the cast. When searching for a specific actor, you may want to retrieve a list of the movies in which they performed. Although the experience is seamless for the end user, they’re still searching for two different types of data. In this case, you’re better off with separate indices. Using separate indices lets you configure each index independently, and tailor them to their specific content.
Conversely, you might want to create a single, unified experience. Users may want to search for anything, see movies and actors in the same results, and rank them together. In this case, a single index would be a better fit.
여러 인덱스는 영화, 배우 등 인덱싱할 데이터의 종류가 다른 경우에 적합합니다. 또한 대부분의 최신 영화 또는 최고 등급 영화와 같이 동일한 데이터에 대해 서로 다른 순위 전략을 제공하는 데 유용합니다. 그러나 인덱스를 구성하는 방법은 레코드를 검색하고 표시하는 방법에 해당합니다.
영화를 검색해 본 경험이 있는 웹사이트와 배우를 위한 또 다른 웹사이트를 상상해 보세요. 동영상을 검색할 때 캐스팅을 검색할 수 있습니다. 특정 배우를 검색할 때 해당 배우가 연기한 영화 목록을 검색할 수 있습니다. 최종 사용자에게는 원활한 환경이지만 여전히 두 가지 유형의 데이터를 검색하고 있습니다. 이 경우에는 인덱스를 별도로 사용하는 것이 좋습니다. 별도의 인덱스를 사용하면 각 인덱스를 독립적으로 구성하고 특정 컨텐츠에 맞게 조정할 수 있습니다.
반대로, 통합된 단일 환경을 만드는 것이 좋습니다. 사용자들은 어떤 것이든 검색하고, 같은 결과에 있는 영화와 배우를 보고, 순위를 매기기를 원할 수 있다. 이 경우 단일 index가 더 적합할 것이다.
Query Suggestions(질의 제안)
There are other use cases for using several indices. For example, if you want to present popular queries with an autocomplete menu, you could leverage the Query Suggestions feature. In this case, you need two indices: one for your content, and one for the common queries.
여러 index를 사용하는 다양한 사용 사례가 있습니다. 예를 들어 자동 완성 메뉴로 인기 있는 쿼리를 표시하려는 경우 쿼리 제안 기능을 활용할 수 있습니다. 이 경우 내용에 대한 인덱스와 공통 쿼리에 대한 인덱스가 각각 하나씩 두 개 필요합니다.
Different sorting strategies(다른 분류 전략)
You also need to use separate indices when you want to let your users switch between different rankings. For example, with a search experience displaying products, you may want to allow users to sort by ascending or descending price. You can’t dynamically change the ranking of an Algolia index, but you can use replica indices. A replica is a special index holding the same data, with different ranking strategy.
Replicas are ideal for providing different sorting options. All you need to do is offer a way for your end users to select a sorting option on your front end and dynamically switch to the right index.
또한 사용자가 다른 순위 간에 전환할 수 있도록 하려면 별도의 색인을 사용해야 합니다. 예를 들어, 제품을 표시하는 검색 환경에서 사용자가 오름차순 또는 내림차순으로 정렬할 수 있도록 허용할 수 있습니다. 알골리아 인덱스의 순위를 동적으로 변경할 수는 없지만 복제본 인덱스를 사용할 수는 있습니다. 복제본은 순위 전략이 다른 동일한 데이터를 저장하는 특수 인덱스입니다.
복제본은 다른 정렬 선택사항을 제공하는 데 적합합니다. 최종 사용자가 프런트 엔드에서 정렬 옵션을 선택하고 오른쪽 인덱스로 동적으로 전환할 수 있는 방법을 제공하기만 하면 됩니다.
Different environments(다른 환경)
It’s best to use separate indices for all your environments and generate new indices and API keys for each of them. This lets you not skew your search analytics, avoids indexing accidents, and keeping each environment more secure.
For example, if you have three environments, such as development, staging, and production, you can create three indices: dev_products, staging_products, and prod_products. To reduce the impact of testing and staging on your operation count, you can use a subset of your data in non-production environments. For example, you can test your staging environment with 10% of your records.
모든 환경에 대해 별도의 인덱스를 사용하고 각 인덱스와 API 키를 새로 생성하는 것이 가장 좋습니다. 따라서 검색 분석을 왜곡하지 않고 인덱싱 사고를 방지하며 각 환경을 더욱 안전하게 유지할 수 있습니다.
예를 들어 개발, 스테이징 및 프로덕션과 같은 세 가지 환경이 있는 경우 dev_products, 스테이징_products 및 prod_products의 세 가지 인덱스를 생성할 수 있습니다. 테스트 및 스테이징이 작업 수에 미치는 영향을 줄이기 위해 프로덕션 이외의 환경에서 데이터의 하위 집합을 사용할 수 있습니다. 예를 들어 레코드의 10%를 사용하여 스테이징 환경을 테스트할 수 있습니다.