How about you 'xml encode' your content, instead of using CDATA:

<field name="subdoc">
  &lt;subdoc id="id_1"&gt;
    &lt;data>testing&lt;/data&gt;
  &lt;/subdoc&gt;
</field>

I don't entirely get what's going on for you. I just did a test, posting
this:

<add>
<doc>
  <field name="id">UV1</field>
  <field name="xml1_s">  <![CDATA[
  <subdoc id="id_1">
    <data>testing</data>
  </subdoc>
  ]]>
  </field>
  <field name="xml2_s">
  &lt;subdoc id="id_1"&gt;
    &lt;data>testing&lt;/data&gt;
  &lt;/subdoc&gt;
  </field>
</doc>
</add>

And querying for id:UV1 gave me the output:

<str name="xml1_s">  
  &lt;subdoc id="id_1"&gt;
    &lt;data&gt;testing&lt;/data&gt;
  &lt;/subdoc&gt;
  
  </str><str name="xml2_s">
  &lt;subdoc id="id_1"&gt;
    &lt;data&gt;testing&lt;/data&gt;
  &lt;/subdoc&gt;
  </str>

So both forms have worked for me.

Upayavira

On Fri, Dec 21, 2012, at 02:44 PM, Modou DIA wrote:
> I am working with an xml format named EAD (Encoded Archival
> Description). That format need to be precompiled before it can be
> digested by solr.
> 
> So I just need to store in my index the original XML file.
> 
> Maybe I need to work with DIH ?
> 
> 2012/12/20 Upayavira <u...@odoko.co.uk>:
> > Solr does not support nested structures. You need to flatten your data
> > before indexing. You can store data in the way you did to be returned to
> > your users, but you will not be able to search within the XML as XML.
> >
> > If you can explain the problem you are trying to solve, maybe folks here
> > can help you find an alternative way of getting there.
> >
> > Upayavira
> >
> > On Thu, Dec 20, 2012, at 02:29 PM, Modou DIA wrote:
> >> Hi everybody,
> >>
> >> i'm newbie with Solr technologies but in the past i worked with lucene
> >> and another solution similar to Solr.
> >> I'm working with solr 4.0. I use solrj for embedding an Solr server in
> >> a cocoon 2.1 application.
> >>
> >> I want to know if it's possible to store (without indexing) a field
> >> containing a xml sequence. I mean a field which can store xml data in
> >> indexes without losing xpath informations.
> >>
> >> For exemple, this's a document to index:
> >>
> >> <add>
> >>   <doc>
> >>     <field name="id">id_1</field>
> >>     <field name="info">testing</field>
> >>     <field name="subdoc">
> >>       <subdoc id="id_1">
> >>         <data>testing</data>
> >>       </subdoc>
> >>     </field>
> >>   </doc>
> >> ...
> >> </add>
> >>
> >> As you can see, the field named subdoc contains an xml sequence.
> >>
> >> So, when i query the indexes, i want to retrieve the data in subdoc
> >> and i want to conserve the xml markup.
> >>
> >> Thank you for your help.
> >> --
> >> ----------
> >> | Modou DIA
> >> | modo...@gmail.com
> >> ----------
> 
> 
> 
> -- 
> ----------
> | Modou DIA
> | modo...@gmail.com
> ----------

Reply via email to