简体   繁体   English

Solr场深度

[英]Solr field depth

How would one set up Solr such that we have "child" node fields? 如何设置Solr以使我们拥有“子”节点字段? For example, for this doc, there exists 2 cars, but each car has a subset of colors. 例如,对于此文档,存在2辆汽车,但每辆汽车都有一个颜色子集。

For example: 例如:

<doc>
  <field name = "make"> Toyota </field>
     <field name = "car"> Camri </field>
        <field name = "color"> Silver </field>
        <field name = "color"> Red </field>
     <field name = "car"> Corolla </field>
        <field name = "color"> Blue </field>
        <field name = "color"> Red </field>
<doc>

How would one go about getting these relationships indexed? 如何将这些关系编入索引?

The general practice is to denormalize the database as Solr works with a plain schema. 通常的做法是在Solr使用纯模式时对数据库进行非规范化。 For example, you can make a multi-valued field and put these values into it: 例如,您可以创建一个多值字段并将这些值放入其中:

  • Camri/Silver 卡姆里/银
  • Camri/Red 卡姆里/红
  • Corolla/Blue 花冠/蓝色
  • Corolla/Red 花冠/红色

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM