mirror of https://github.com/apache/lucene.git
SOLR-11075: Refactor handling of params in CloudSolrStream and FacetStream
This commit is contained in:
parent
bab1731b23
commit
b17ec1445d
|
@ -87,6 +87,7 @@ Other Changes
|
|||
|
||||
* SOLR-10964: Reduce SolrIndexSearcher casting in LTRRescorer. (Christine Poerschke)
|
||||
|
||||
* SOLR-11075: Refactor handling of params in CloudSolrStream and FacetStream (Erick Erickson)
|
||||
================== 7.0.0 ==================
|
||||
|
||||
Versions of Major Components
|
||||
|
|
|
@ -73,7 +73,7 @@ public class CloudSolrStream extends TupleStream implements Expressible {
|
|||
|
||||
protected String zkHost;
|
||||
protected String collection;
|
||||
protected SolrParams params;
|
||||
protected ModifiableSolrParams params;
|
||||
protected Map<String, String> fieldMappings;
|
||||
protected StreamComparator comp;
|
||||
private boolean trace;
|
||||
|
@ -172,23 +172,13 @@ public class CloudSolrStream extends TupleStream implements Expressible {
|
|||
// collection
|
||||
expression.addParameter(collection);
|
||||
|
||||
ModifiableSolrParams mParams = new ModifiableSolrParams(SolrParams.toMultiMap(params.toNamedList()));
|
||||
for (Entry<String, String[]> param : mParams.getMap().entrySet()) {
|
||||
|
||||
if(param.getKey().equals("fq")) {
|
||||
for(String fqParam : param.getValue()) {
|
||||
// See comment below for params containg a " character
|
||||
expression.addParameter(new StreamExpressionNamedParameter(param.getKey(),
|
||||
fqParam.replace("\"", "\\\"")));
|
||||
}
|
||||
} else {
|
||||
String value = String.join(",", param.getValue());
|
||||
|
||||
// SOLR-8409: This is a special case where the params contain a " character
|
||||
for (Entry<String, String[]> param : params.getMap().entrySet()) {
|
||||
for (String val : param.getValue()) {
|
||||
// SOLR-8409: Escaping the " is a special case.
|
||||
// Do note that in any other BASE streams with parameters where a " might come into play
|
||||
// that this same replacement needs to take place.
|
||||
value = value.replace("\"", "\\\"");
|
||||
expression.addParameter(new StreamExpressionNamedParameter(param.getKey(), value));
|
||||
expression.addParameter(new StreamExpressionNamedParameter(param.getKey(),
|
||||
val.replace("\"", "\\\"")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public class FacetStream extends TupleStream implements Expressible {
|
|||
private List<Tuple> tuples = new ArrayList<Tuple>();
|
||||
private int index;
|
||||
private String zkHost;
|
||||
private SolrParams params;
|
||||
private ModifiableSolrParams params;
|
||||
private String collection;
|
||||
protected transient SolrClientCache cache;
|
||||
protected transient CloudSolrClient cloudSolrClient;
|
||||
|
@ -216,7 +216,7 @@ public class FacetStream extends TupleStream implements Expressible {
|
|||
|
||||
private void init(String collection, SolrParams params, Bucket[] buckets, FieldComparator[] bucketSorts, Metric[] metrics, int bucketSizeLimit, String zkHost) throws IOException {
|
||||
this.zkHost = zkHost;
|
||||
this.params = params;
|
||||
this.params = new ModifiableSolrParams(params);
|
||||
this.buckets = buckets;
|
||||
this.metrics = metrics;
|
||||
this.bucketSizeLimit = bucketSizeLimit;
|
||||
|
@ -242,11 +242,11 @@ public class FacetStream extends TupleStream implements Expressible {
|
|||
expression.addParameter(collection);
|
||||
|
||||
// parameters
|
||||
ModifiableSolrParams tmpParams = new ModifiableSolrParams(params);
|
||||
|
||||
for (Entry<String, String[]> param : tmpParams.getMap().entrySet()) {
|
||||
expression.addParameter(new StreamExpressionNamedParameter(param.getKey(),
|
||||
String.join(",", param.getValue())));
|
||||
for (Entry<String, String[]> param : params.getMap().entrySet()) {
|
||||
for (String val : param.getValue()) {
|
||||
expression.addParameter(new StreamExpressionNamedParameter(param.getKey(), val));
|
||||
}
|
||||
}
|
||||
|
||||
// buckets
|
||||
|
|
Loading…
Reference in New Issue