父母在apache solr中索引

时间:2018-04-30 14:14:40

标签: solr

我是Apache solr搜索的新手。我没有得到带有子文档的solr搜索结果。

我在data-config.xml中的实体

<entity  name="products" query="SELECT DISTINCT IDENTIFIER,PDT_NAME,PDT_DESCRIPTION FROM **PARENT_TABLE**"
    deltaQuery="SELECT IDENTIFIER FROM PARENT_TABLE WHERE LAST_MODIFIED_DATE > '${dataimporter.last_index_time}'">
        <field column="IDENTIFIER" name="pdtid" />  
        <field column="PDT_NAME" name="productname" />  
        <field column="PDT_DESCRIPTION" name="productdescription" />
        <entity name="productVersions" child="true" query="SELECT DISTINCT child_id , child_name FROM  WHERE IDENTIFIER = '${**products.IDENTIFIER**}'"> 
                <field column="IDENTIFIER" name="productVersions.pdtesat" />
                <field column="VERSION_NUMBER" name="productVersions.versionnum" />
                <field column="DISPLAY_NAME" name="productVersions.displayname" />                                
        </entity>
</entity>

托管架构文件中的字段详细信息:

<field name="pdtid" type="text_general" indexed="true" stored="true" multiValued="false" />
<field name="productname" type="text_general" indexed="true" stored="true" multiValued="true" />
<field name="productnamerrr" type="text_general" indexed="true" stored="true" multiValued="false" />
<field name="productdescription" type="text_general" indexed="true" stored="true" multiValued="false" />
<field name="productVersions.childid" type="text_general" indexed="true" stored="true" multiValued="false" />
<field name="productVersions.versionnum" type="text_general" indexed="true" stored="true" multiValued="false" />
<field name="productVersions.displayname" type="text_general" indexed="true" stored="true" multiValued="false" />

我期待我的solr结果应该是:

 "response":{"numFound":26,"start":0,"docs":[
      {
        "productdescription":" Java",
        "productnamerrr":"pdtid",
        "pdtid":"6591",
        "child_docs" : [
                "productVersions":[
                            "productVersions.childid":"123"
                            "productVersions.versionnum":"V1"
                            "productVersions.displayname":"disp"],
                "productVersions":[
                    "productVersions.childid":"456"
                    "productVersions.versionnum":"V2"
                    "productVersions.displayname":"disp2"]
                    ],
        "id":"92689209-dc5f-4ae6-bd3c-d55dbd0e200c",
        "_version_":1599132440456069120},

请在编制索引后帮助我以json格式获取多个子文档。

5月2日编辑。

我的搜索结果来自solr搜索,如下所示。

"response":{"numFound":38,"start":0,"docs":[
      {
        "productdescription":" JIRA provides issue (bug) and project tracking 
                               for the software development team.",
        "productnamerrr":"Atlassian JIRA",
        "productVersions":
                ["childid:6.x,versionnum:Jira 6.x,displayname :Withdrawn",
                 "childid:2.0.3,versionnum:Atlassian JIRA,displayname:Planning",
                 "childid:JIRA Server 5.0.1 - 6.3.15,versionnum:JIRA - JEditor,displayname :Withdrawn",
                 "childid:1.x,versionnum:Jira 1.x,displayname :Withdrawn"
                ],
        "id":"0b5ba528-ef7a-49ba-a97b-2ea94922cbb5",
        "_version_":1599297669816123392},

于5月3日至20日编辑

返回的数据是正确的。但我明确地期待父母子文件。获得以下儿童文档。

"productVersions":["childid:6.x,versionnum:Jira 6.x,displayname :Withdrawn",
             "childid:2.0.3,versionnum:Atlassian JIRA,displayname:Planning",
             "childid:JIRA Server 5.0.1 - 6.3.15,versionnum:JIRA - JEditor,displayname :Withdrawn",
             "childid:1.x,versionnum:Jira 1.x,displayname :Withdrawn"
            ], 

期待如下。

    "productVersions":[ 
                    "productVersions.childid":"123"
                    "productVersions.versionnum":"V1"
                   "productVersions.displayname":"disp"],
"productVersions":[
                    "productVersions.childid":"456"
                    "productVersions.versionnum":"V2"
                    "productVersions.displayname":"disp2"]
                    ],               

如何更改查询以将子文档作为单独的实体单独获取。??

0 个答案:

没有答案