mirror of https://github.com/apache/lucene.git
SOLR-3214: If you use multiple fl entries rather than a comma separated list, all but the first entry can be ignored if you are using distributed search.
SOLR-3256: Distributed search throws NPE when using fl=score git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1305927 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
46724924e4
commit
7b3f632f32
|
@ -1,4 +1,4 @@
|
|||
Apache Solr Release Notes
|
||||
Apache Solr Release Notes
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
@ -353,7 +353,9 @@ Bug Fixes
|
|||
|
||||
* SOLR-3062: A join in the main query was not respecting any filters pushed
|
||||
down to it via acceptDocs since LUCENE-1536. (Mike Hugo, yonik)
|
||||
|
||||
|
||||
* SOLR-3214: If you use multiple fl entries rather than a comma separated list, all but the first
|
||||
entry can be ignored if you are using distributed search. (Tomas Fernandez Lobbe via Mark Miller)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
|
|
@ -941,17 +941,10 @@ public class QueryComponent extends SearchComponent
|
|||
// we already have the field sort values
|
||||
sreq.params.remove(ResponseBuilder.FIELD_SORT_VALUES);
|
||||
|
||||
// make sure that the id is returned for correlation.
|
||||
String fl = sreq.params.get(CommonParams.FL);
|
||||
if (fl != null) {
|
||||
fl = fl.trim();
|
||||
// currently, "score" is synonymous with "*,score" so
|
||||
// don't add "id" if the fl is empty or "score" or it would change the meaning.
|
||||
if (fl.length()!=0 && !"score".equals(fl) && !"*".equals(fl)) {
|
||||
sreq.params.set(CommonParams.FL, fl+','+uniqueField.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if(!rb.rsp.getReturnFields().wantsField(uniqueField.getName())) {
|
||||
sreq.params.add(CommonParams.FL, uniqueField.getName());
|
||||
}
|
||||
|
||||
ArrayList<String> ids = new ArrayList<String>(shardDocs.size());
|
||||
for (ShardDoc shardDoc : shardDocs) {
|
||||
// TODO: depending on the type, we may need more tha a simple toString()?
|
||||
|
@ -979,6 +972,7 @@ public class QueryComponent extends SearchComponent
|
|||
SolrDocumentList docs = (SolrDocumentList)srsp.getSolrResponse().getResponse().get("response");
|
||||
|
||||
String keyFieldName = rb.req.getSchema().getUniqueKeyField().getName();
|
||||
boolean removeKeyField = !rb.rsp.getReturnFields().wantsField(keyFieldName);
|
||||
|
||||
for (SolrDocument doc : docs) {
|
||||
Object id = doc.getFieldValue(keyFieldName);
|
||||
|
@ -987,6 +981,9 @@ public class QueryComponent extends SearchComponent
|
|||
if (returnScores && sdoc.score != null) {
|
||||
doc.setField("score", sdoc.score);
|
||||
}
|
||||
if(removeKeyField) {
|
||||
doc.removeFields(keyFieldName);
|
||||
}
|
||||
rb._responseDocs.set(sdoc.positionInResponse, doc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,6 +204,16 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
|
|||
"facet.range.start",200,
|
||||
"facet.range.gap",100,
|
||||
"f."+tlong+".facet.range.end",900);
|
||||
|
||||
// variations of fl
|
||||
query("q","*:*", "fl","score","sort",i1 + " desc");
|
||||
query("q","*:*", "fl",i1 + ",score","sort",i1 + " desc");
|
||||
query("q","*:*", "fl", i1, "fl","score","sort",i1 + " desc");
|
||||
query("q","*:*", "fl", "id," + i1,"sort",i1 + " desc");
|
||||
query("q","*:*", "fl", "id", "fl",i1,"sort",i1 + " desc");
|
||||
query("q","*:*", "fl",i1, "fl", "id","sort",i1 + " desc");
|
||||
query("q","*:*", "fl", "id", "fl",nint, "fl",tint,"sort",i1 + " desc");
|
||||
query("q","*:*", "fl",nint, "fl", "id", "fl",tint,"sort",i1 + " desc");
|
||||
|
||||
stress=0; // turn off stress... we want to tex max combos in min time
|
||||
for (int i=0; i<25*RANDOM_MULTIPLIER; i++) {
|
||||
|
|
Loading…
Reference in New Issue