[ 
https://issues.apache.org/jira/browse/SOLR-6045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13992784#comment-13992784
 ] 

Scott Lindner commented on SOLR-6045:
-------------------------------------

Maybe the problem is actually the fact that the OOB RequestWriter works when it 
shouldn't?  It must be taking the multiple "actions" and combining them into a 
single Map - and while that actually sounded good to me at first, the code in 
the distributed update processor is basically unpredictable if you combine 
multiple actions.

For instance a "set" followed by an "add" is OK but if they are processed in 
the other order then the "set" will overwrite the "add".  I think logically 
that's fine but then the actions need to have a predictable precedence and I 
think the only logical ordering would be something like:

remove --> incr --> set --> add

In any case I think the point here is that using the OOB RequestWriter or the 
BinaryRequestWriter shouldn't impact behavior and should be consistent.

> atomic updates w/ solrj + BinaryRequestWriter aren't working when adding 
> multiple fields w/ same name in a single SolrInputDocument
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-6045
>                 URL: https://issues.apache.org/jira/browse/SOLR-6045
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 4.8
>         Environment: client & server both on 4.8
>            Reporter: Scott Lindner
>
> I'm using the following code snippet:
> {code}
>         HttpSolrServer srvr = new HttpSolrServer("HOST:8983/solr/foo-test");
>         SolrInputDocument sid = new SolrInputDocument();
>         sid.addField("id", "some_id");
>         Map<String, String> fieldModifier = Maps.newHashMap();
>         fieldModifier.put("set", "new_value1");
>         sid.addField("field1", fieldModifier);
>         Map<String, Object> fieldModifier2 = Maps.newHashMap();
>         fieldModifier2.put("set", "new_value2");
>         sid.addField("field1", fieldModifier2);
>         srvr.add(sid);
>         srvr.commit();
> {code}
> *NOTE*: the important part here is that I am using the same field name and 
> adding 2 values separately to the same solr document.
> This produces the correct values in the index.  Here is the output from 
> searching from the admin console:
> {noformat}
> "field1": [
>           "new_value1",
>           "new_value2"
>         ]
> {noformat}
> However if I modify the above code to have the following lines after creating 
> the SolrServer:
> {code}
>         srvr.setRequestWriter(new BinaryRequestWriter());
>         srvr.setParser(new BinaryResponseParser());
> {code}
> Then the values that are returned are incorrect:
> {noformat}
> "field1": [
>           "{set=new_value1}",
>           "{set=new_value2}"
>         ]
> {noformat}
> This also behaves the same if I use the CloudSolrServer as well.
> If I modify my code to look like the following:
> {code}
>         Map<String, List<String>> fieldModifier = Maps.newHashMap();
>         fieldModifier.put("set", Lists.newArrayList("new_value1", 
> "new_value2"));
>         sid.addField("field1", fieldModifier);
> {code}
> Then this *does* work with the BinaryRequestWriter.  So this seems to be an 
> issue when calling addField() with the same name multiple times.
> In the process of debugging this I think I also uncovered a few other similar 
> issues but I will file separate bugs for those.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to