似乎SolrQuery.add(SolrParams params)
覆盖了相同的键:
ModifiableSolrParams params1 = getParamsForTagsFacet(); // this has a 'facet.field'
ModifiableSolrParams params2 = getParamsForRegionsFacet(); // this has a 'facet.field'
SolrQuery q = new SolrQuery() // extends ModifiableSolrParams
q.add(params1); // adds first 'facet.field'
q.add(params2); // overwrites first 'facet.field'
q.add(String key, String... value)
改为保留两个 'facet.field'键
ModifiableSolrParams solrParams = facet.createSolrParams();
Iterator<String> iterator = solrParams.getParameterNamesIterator();
while(iterator.hasNext()){
String param = iterator.next();
String value = solrParams.get(param);
// adding multiple identical params like this works.
// It creates a single key with multiple values in the underlying LinkedHashMap
q.add(param, value);
}