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

David Smiley commented on SOLR-18621:
-------------------------------------

It'd be tempting to use the static method name `params` instead of `of` so that 
various places can simply do a static import.  WDYT?  CC [~gerlowskija]

There's a concern about null handling.  I'm inclined to map them to the empty 
string to match what a real Solr request does in 
{{SolrRequestParsers.parseFormDataContent}} when there's no value.

> 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
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> 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