【问题标题】:Solr Nested (child) entitiesSolr 嵌套(子)实体
【发布时间】:2016-10-25 23:52:41
【问题描述】:

在我的 dataConfig 中,我遵循了这个示例。 Solr 版本:6.0.0

 <dataConfig> 
<dataSource driver="org.hsqldb.jdbcDriver" url="jdbc:hsqldb:/temp/example/ex" user="sa" /> 
<document name="products"> 
<entity name="item" query="select * from item"> 
<field column="ID" name="id" /> 
<field column="NAME" name="name" /> 
<field column="MANU" name="manu" /> 
<field column="WEIGHT" name="weight" /> 
<field column="PRICE" name="price" /> 
<field column="POPULARITY" name="popularity" /> 
<field column="INSTOCK" name="inStock" /> 
<field column="INCLUDES" name="includes" />

<entity name="feature" query="select description from feature where item_id='${item.ID}'"> 
<field name="features" column="description" /> 
</entity> 
<entity name="item_category" query="select CATEGORY_ID from item_category where item_id='${item.ID}'"> 
<entity name="category" query="select description from category where id = '${item_category.CATEGORY_ID}'"> 
<field column="description" name="cat" /> 
</entity> 
</entity> 
</entity> 
</document> 
</dataConfig>

但数据导入后我无法获取子节点。 我也尝试了动态字段,我得到了相同的结果。 在导入数据之前是否需要做一些事情才能完成这项工作。

【问题讨论】:

    标签: database indexing solr nodes entities


    【解决方案1】:

    尝试将 PK 属性添加到您的项目实体:

    <entity name="item" pk="ID" query="select * from item"> 
    

    这应该使它对其子级可用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-06
      相关资源
      最近更新 更多