: If you're submitting documents as XML, you're always going to have to
: escape meaningful XML characters going in. If you ask for them back as
: XML, you should be prepared to unescape special XML characters as

that still wouldn't explain the discrepency he's claiming to see between 
the json & xml resmonses (the json containing an empty string

Jack: please elaborate with specifics about your solr version, field, 
field type, how you indexed your doc, and what the request urls & raw 
responses that you get are (ie: don't trust the XML you see in your 
browser, it may be unescaping escaped sequences in element text to be 
"helpful" .. use something like curl)

For example...

----BEGIN GOOD EXAMPLE OF SPECIFICS---

I'm using Solr 4.x with the 4.x example schema which has the following 
field...

   <field name="cat" type="string" indexed="true" stored="true" 
multiValued="true"/>
   <fieldType name="string" class="solr.StrField" sortMissingLast="true" />

I indexed a doc like this...

$ curl "http://localhost:8983/solr/update?commit=true"; -H 
'Content-type:application/json' -d '[{"id":"hoss", "cat":"<Something to use as 
a source node>" } ]'

And this is what i get from the following requests...

$ curl 
"http://localhost:8983/solr/select?q=id:hoss&wt=xml&indent=true&omitHeader=true";
 
<?xml version="1.0" encoding="UTF-8"?>
<response>

<result name="response" numFound="1" start="0">
  <doc>
    <str name="id">hoss</str>
    <arr name="cat">
      <str>&lt;Something to use as a source node&gt;</str>
    </arr>
    <long name="_version_">1427705631375097856</long></doc>
</result>
</response>

$ curl 
"http://localhost:8983/solr/select?q=id:hoss&wt=json&indent=true&omitHeader=true";
 
{
  "response":{"numFound":1,"start":0,"docs":[
      {
        "id":"hoss",
        "cat":["<Something to use as a source node>"],
        "_version_":1427705631375097856}]
  }}

$ curl 
"http://localhost:8983/solr/select?q=cat:%22<Something+to+use+as+a+source+node>%22&wt=json&indent=true&omitHeader=true"
 
{
  "response":{"numFound":1,"start":0,"docs":[
      {
        "id":"hoss",
        "cat":["<Something to use as a source node>"],
        "_version_":1427705631375097856}]
  }}

----END GOOD EXAMPLE OF SPECIFICS---

: > Even more curious, if I use this query at the console:
: >
: > details:<Something to use as a source node>
: >
: > I get nothing back.

note in my last example above the importance of using quotes (or the 
{!term} qparser) to query string fields that contain special characters 
like whitespace -- whitespace is syntacally meaningul to the lucene query 
parser, it seperates clauses of a boolean query.


-Hoss

Reply via email to