I uncommented out the line which sets server to an XMLResponse parser,
and used the following code in a tiny test:

                String sourceNodeLocator = node.getLocator();
                Map<String,Object> updateMap = new HashMap<String,Object>();
                Map<String,Object> newMap = new HashMap<String,Object>();
                Map<String,Object> myMap = node.getProperties();
                List<String>values = (List<String>) myMap.get(key);
                String what = "set";
                values.add(newValue);
                updateMap.put(ITopicQuestsOntology.LOCATOR_PROPERTY, 
sourceNodeLocator);
                newMap.put(what,values);
                updateMap.put(key, newMap);
                IResult result = solr.partialUpdateData(updateMap);;

The printstring fragment from that test look like this:

<node locator="MySecondNode1361728848603">
  <property key="details" >
    <value><![CDATA[here & there]]></value>
    <value><![CDATA[Oh Fudge]]></value>
  </property>

and fetching in JSON from the admin query console looks like this:
        "locator": "MySecondNode1361728848603",
        "details": [
          "here & there",
          "Oh Fudge"
        ],

It appears that using the XMLResponseParser and getting the query
string right works!

Many thanks for all the comments.

Cheers
Jack

On Thu, Feb 21, 2013 at 5:45 PM, Shawn Heisey <s...@elyograg.org> wrote:
> On 2/21/2013 10:00 AM, Jack Park wrote:
>>
>> Interesting you should say that.  Here is my solrj code:
>>
>>         public Solr3Client(String solrURL) throws Exception {
>>                 server = new HttpSolrServer(solrURL);
>>         //      server.setParser(new XMLResponseParser());
>>         }
>>
>> I cannot recall why I commented out the setParser line; something
>> about someone saying in another thread it's not important. I suppose I
>> should revisit my unit tests with that line uncommented. Or, did I
>> miss something?
>>
>> The JSON results I painted earlier were from reading the document
>> online in the admin query panel.
>
>
> Jack,
>
> SolrJ defaults to the javabin response parser, which offers maximum
> efficiency in the communication.  Between version 1.4.1 and 3.1.0, the
> javabin version changed and became incompatible with the old one.
>
> The XML parser is a little bit less efficient than javabin, but is the only
> way to get Solr/SolrJ to talk when one side is using a different javabin
> version than the other side.  If you are not mixing 1.x with later versions,
> you do not need to worry about changing the response parser.
>
> Thanks,
> Shawn
>

Reply via email to