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

Hoss Man commented on SOLR-6576:
--------------------------------

I haven't looked at this closely, but I think the behavior you are observing is 
intentional -- although it almost certainly needs better docs, and is probably 
not the best name.

I think the intent here was for ModifiableSolrParam.add(SolrParams) to be 
analogous to Map.putAll(Map).  It's not a shortcut for adding all of _values_ 
associated with each key in the argument SolrParams object; it's a method for 
updating the current SolrParams object to have all of the _params_ (keys and 
values) in the argument SolrParams object

Since the semantics are clearly ambiguous, and a change like this could really 
screw things up for existing users who expect the current behavior, the best 
course of action may be to deprecate the method completely and add new methods 
with more clear names?

(FWIW: your desired goal is exactly what SolrParams.wrapAppended(SolrParams) 
was designed for.)

> ModifiableSolrParams#add(SolrParams) is performing a set operation instead of 
> an add
> ------------------------------------------------------------------------------------
>
>                 Key: SOLR-6576
>                 URL: https://issues.apache.org/jira/browse/SOLR-6576
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Steve Davids
>             Fix For: 5.0, Trunk
>
>         Attachments: SOLR-6576.patch
>
>
> Came across this bug by attempting to append multiple ModifiableSolrParam 
> objects together but found the last one was clobbering the previously set 
> values. The add operation should append the values to the previously defined 
> values, not perform a set operation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to