본문 바로가기
개발/ALGOLIA

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

by dev_caleb 2022. 2. 28.
728x90

Creating Parent-Child Relationships

If your source data has parent-child relationships between records and you want to maintain those relationships when you migrate to Algolia’s JSON format, this guide outlines the recommended indexing process.

원본 데이터가 레코드 간에 상위-하위 관계가 있고 Algolia의 JSON 형식으로 마이그레이션할 때 이러한 관계를 유지하려면 이 가이드에서 권장 인덱싱 프로세스를 설명합니다.

 

Use parent-child relationships when you want to:

  • Filter on children
  • Update parents without affecting children
  • Add children without affecting parents or other children
  • Index a tree-like data structure
  • Model a one-to-many relationship.

원하는 경우 부모-자식 관계 사용:
하위 항목 필터링
자식에게 영향을 미치지 않고 부모 업데이트
부모 또는 다른 자녀에게 영향을 미치지 않고 자녀 추가
트리 같은 데이터 구조 인덱싱
일대다 관계를 모델링합니다.

 

 

Modeling the relationship in your JSON file(JSON file에서 관계 모델링 하기)

To model a parent-child relationship in the records of your Algolia JSON data:

  • Create one record per child, and add a unique reference to their parent as a key-value pair (parentID in the example)
  • Don’t create records for parents.

Algolia JSON 데이터의 레코드에서 상위-하위 관계를 모델링하려면:
-하위 항목별로 레코드를 하나씩 만들고 상위 항목에 키-값 쌍(상위 항목)으로 고유 참조를 추가합니다.예제의 ID)
-상위 항목 레코드를 만들지 마세요.

 

[
   {
      "parentID":"ABC",
      "parentName":"Parent",
      "name":"Child One"
   },
   {
      "parentID":"ABC",
      "parentName":"Parent",
      "name":"Child Two"
   }
]

 

 

 

Implementation notes(노트 구현)

Since:

  • You don’t have any parent records: you can only query children.
  • A parent may have many children: use Algolia’s distinct feature to retrieve the most relevant child per parent ( parentID in the preceding example).

이후:
상위 레코드가 없습니다. 하위 항목만 쿼리할 수 있습니다.
부모에는 많은 자식이 있을 수 있습니다. Algolia의 고유한 기능을 사용하여 부모당 가장 관련성이 높은 자식(상위)을 검색합니다.ID(앞의 예)를 참조하십시오.

 

728x90