Mailing List Archive

[SOLR] How to index the nested xml with multipleValues
Hello Guys,

I m trying to index the below XML document with the below defined schema.

My Goal is to search like q=(tagname_s:PkiTrustPoint AND
childTagName_s:EnrollmentUrl) and expecting to return all the documents
which contains these info.

In my case, there could be multiple childTags with different names under
the tag ?
Can you please help me on how the schema should be written to accomadate
this ?

I went thru the documentation and couldnt exactly figure out how to define
this in schema.

Sample XML file :

<contents>
<id>1</id>
<tag>
<name>PkiTrustPoint</name>
<attribute>
<name>name</name>
<value>sdn-network-infra-iwan11</value>
<newone>newone</newone>
</attribute>
<childTag>
<childTagId>11</childTagId>
<name>EnrollmentUrl</name>
<attribute>
<name>url</name>
<value>http://10.170.101.111:80/ejbca/publicweb/apply/scep/sdnscep</value>
</attribute>
</childTag>
<childTag> <childTagId>12</childTagId> <name>RevocationCheckMethod</name>
<attribute> <name>none</name> <value>true</value> </attribute> </childTag>
</tag>
</contents>

Schema file for the above XML

<dataConfig>
<dataSource type="FileDataSource"/>
<document>
<!-- this outer processor generates a list of files satisfying the
conditions specified in the attributes -->
<entity name="f1" processor="FileListEntityProcessor"
fileName=".*.xml$" recursive="true" rootEntity="false" dataSource="null"
baseDir="/Users/pkutteng/Downloads/solr/solr-6.4.1/example-data/">

<!-- this processor extracts content using Xpath from each file found
-->

<entity name="nested1" processor="XPathEntityProcessor"
forEach="/contents" url="${f1.fileAbsolutePath}" >
<field column="id" xpath="/contents/id"/>
<field column="tagname_s" xpath="/contents/tag/name"/>
<field column="attributename_s"
xpath="/contents/tag/attribute/name"/>
<field column="attributevalue_s"
xpath="/contents/tag/attribute/value"/>
<field column="childtagname_s"
xpath="/contents/tag/childTag/name"/>
<field column="childAttributeName_s"
xpath="/contents/tag/childTag/attribute/name"/>
<field column="childAttributeValue_s"
xpath="/contents/tag/childTag/attribute/value"/>
</entity>
</entity>
</document>
</dataConfig>


Any help on this front is greatly appreciated.

Regards
Prathib Kumar.