0

I have an xml which looks something like as below:

 <info>
  <metadata>
    <topic>ww2</topic>
    <subject>history</subject>
  </metadata>
  <information>
    <catalogs isreq="1" schema_version="1.0.0" >
      <catalog group="1" part_of_sub="N">
        <country>FR</country>
        <year format="yyyy-mm-dd">1885-11-02</year >
        </category_definition>
     <catalog group="1" part_of_sub="Y">
        <country>GR</country>
        <year format="yyyy-mm-dd">1885-11-02</year >
        </category_definition>
        </catalogs>
         </information>
     </info>  

I want to index this xml without flattening it. I did saw childDocuments getting used for indexing complex json [referring to this http://yonik.com/solr-nested-objects/ ]. I am not really sure how to use this for xml document?

sam N
  • 83
  • 1
  • 8
  • So how do you want to query it? – MatsLindh Jan 16 '19 at 22:02
  • I would like to query solr something like country:"FR" and it should return me all the documents which would satisfy the criteria. – sam N Jan 17 '19 at 12:34
  • And what would a document be in that context? The whole `` structure? – MatsLindh Jan 17 '19 at 13:37
  • What is it that you think 'flattening' means in that context and what exactly do you want to avoid about it? – Harald Jan 17 '19 at 19:35
  • FWIW avoid child documents - see my answer for another question here https://stackoverflow.com/a/54244434/277023 – kellyfj Jan 17 '19 at 21:21
  • To answer @MatsLindh , yes you are correct to think that. I would like to index entire xml. – sam N Jan 18 '19 at 14:05
  • To Answer @Harald, when I say flattening, all the child and respective parent elements of the xml becomes a simple elements of of SOLR. Something like below : 1 1 Fabulous Book Angelo Author – sam N Jan 18 '19 at 14:07
  • @kellyfj Thanks for pointing this out. It is really helpful. – sam N Jan 18 '19 at 14:19

0 Answers0