Solr索引:父/子文档

Dek*_*ekx 3 solr solrj

我正在使用Solr来索引某些内容但是目前,这些内容被认为是与父/子相关的.

我有类似的东西:

<doc>
  <id>*an Id*</id>
  <path>*a path*</path>
  <title>*a title*</title>
  <type>**Page**</type>
</doc>
<doc>
  <id>*an other Id*</id>
  <path>*a other path*</path>
  <title>*a other title*</title>
  <type>**Component**</type>
</doc>
Run Code Online (Sandbox Code Playgroud)

但我想有一些接近的东西:

<doc>
  <id>*an Id*</id>
  <path>*a path*</path>
  <title>*a title*</title>
  <type>**Page**</type>
  <child>
    <id>*an Id*</id>
    <path>*a path*</path>
    <title>*a title*</title>
    <type>**Component**</type>
  </child>
</doc>
Run Code Online (Sandbox Code Playgroud)

我想知道它是否可能,我怎样才能设法定义我的schema.xml方式?

我正在使用Solr 3.6,我无法改变它.

我希望有人可以帮我一臂之力.

此致,Dekx.

小智 6

SOLR现在(自4.5?)支持/模拟父/子文档,请参阅示例SOLR-schema:

<!-- points to the root document of a block of nested documents. Required for nested
document support, may be removed otherwise -->
<field name="_root_" type="string" indexed="true" stored="false"/> 
Run Code Online (Sandbox Code Playgroud)

甚至SOLR-J也支持将childDocuments添加到SolrInputDocument.但很难找到任何文件.