David Smiley created SOLR-18621:
-----------------------------------

             Summary: Add SolrParams.of(String...) and 
ModifiableSolrParams.of(String...) factory methods
                 Key: SOLR-18621
                 URL: https://issues.apache.org/jira/browse/SOLR-18621
             Project: Solr
          Issue Type: Improvement
            Reporter: David Smiley
            Assignee: David Smiley


Add SolrParams.of(String...) and ModifiableSolrParams.of(String...) factory 
methods

SolrTestCaseJ4.params(String...) is a convenient way to build params from 
key/value pairs, but it lives in the test framework, so main code and other 
test bases keep re-implementing it (e.g. {{CollectionsHandler.params}}, 
{{CoreAdminHandler.params}}, {{SyncStrategy.params}}, {{StreamTool.params}}, 
{{SolrBenchState.params}}).

Proposal: add the same capability to SolrJ.

* {{SolrParams.of(String... kv)}} returns an *unmodifiable* SolrParams.
* {{ModifiableSolrParams.of(String... kv)}} returns a new 
{{ModifiableSolrParams}}.
** Also adds {{of()}} and {{of(String, String)}} overloads so every {{of}} 
callable on {{ModifiableSolrParams}} returns the modifiable type (statics are 
inherited from {{SolrParams}}).

Semantics:
* Arguments are name/value pairs; an odd count throws 
{{IllegalArgumentException}}.
* Repeated names become multi-values.
* A null name or value is treated as the empty string.

Existing {{params(String...)}} helpers (SolrTestCaseJ4 and the ones listed 
above) delegate to the new method. Their callers are not migrated here.


🤖 AI generated with Claude Code




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to