Hi, Thanks for the quick response. Now, I have one more question. Is it possible to get the result for a query back in the following form (considering the input is the escaped xml, what you mentioned before):
<response> <responseHeader> <status>0</status> <QTime>0</QTime> </responseHeader> <result numFound="1" start="0"> <doc> <str name="label">As You Like It (Promptbook of McVicars 1860)</str <str name="author">Shakespeare, William,</str> <str name="record"><myxml>...</myxml></str> </doc> </result> </response> Note, that the here the xml data is not escaped. If yes, what do I have to do to get such results back? Would <str> need to be replaced with a type, say, <xml> which has a different write method? Or will I only be able to display escaped xml within <str> (and any other types). If so, why? thanks, mirko Quoting Chris Hostetter <[EMAIL PROTECTED]>: > > Since XML is the transport for sending data to Solr, you need to make sure > all field values are XML escaped. > > If you wanted to index a plain text "title" and that tile contained an > ampersand character.... > > Sense & Sensability > > ...you would need to XML escape that as... > > Sense & Sensability > > ...Solr internally will treat that consistently as the JAva string "Sense > & Sensability" and when it comes time to return that string back to your > query clients, will output it in whatever form is appropraite for your > ResponseWriter -- if that's XML, then it will be XML escaped again, if > it's JSON or something ike it, it can probably be left alone. > > The same holds tru for any other characters you wna to include in your > field values: Solr doens't care that they *value* itself is an XML string, > just that you properly escape the value in your XML <add><doc> message to > Solr... > > <add> > <doc> > <field name="title">As You Like it</field> > <field name="author">Shakespeare, William</field> > <field name="record"><myxml>here goes the > xml...</myxml></field> > </doc> > </add> > > ...does that make sense? > > : Ideally, I would like to store the xml as is, and index only the content > : removing the xml-tags (I believe there is HTMLStripWhitespaceAnalyzer for > : that). > : And output the result as an xml (so, simple escaping does not work for me). > > the escaping is just to send the data to Solr -- once sent, Solr will > process the unescaped string when deailing with analyzers, etc exactly as > you'd expect. > > > -Hoss >