mirror of https://github.com/apache/lucene.git
SOLR-6118: expand.sort bug for function queries; needed to sort.rewrite(searcher)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1598138 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4c29d60c62
commit
36c9276bba
|
@ -84,7 +84,7 @@ import java.util.Map;
|
|||
* expand.fq=type:child (optional, overrides the main filter queries)<br/>
|
||||
* expand.field=field (mandatory if the not used with the CollapsingQParserPlugin)<br/>
|
||||
**/
|
||||
|
||||
|
||||
public class ExpandComponent extends SearchComponent implements PluginInfoInitialized, SolrCoreAware {
|
||||
public static final String COMPONENT_NAME = "expand";
|
||||
private PluginInfo info = PluginInfo.EMPTY_INFO;
|
||||
|
@ -205,6 +205,8 @@ public class ExpandComponent extends SearchComponent implements PluginInfoInitia
|
|||
}
|
||||
|
||||
Collector collector = null;
|
||||
if (sort != null)
|
||||
sort = sort.rewrite(searcher);
|
||||
GroupExpandCollector groupExpandCollector = new GroupExpandCollector(values, groupBits, collapsedSet, limit, sort);
|
||||
SolrIndexSearcher.ProcessedFilter pfilter = searcher.getProcessedFilter(null, newFilters);
|
||||
if(pfilter.postFilter != null) {
|
||||
|
@ -326,14 +328,14 @@ public class ExpandComponent extends SearchComponent implements PluginInfoInitia
|
|||
leafCollectors.put(entry.key, entry.value.getLeafCollector(context));
|
||||
}
|
||||
return new LeafCollector() {
|
||||
|
||||
|
||||
@Override
|
||||
public void setScorer(Scorer scorer) throws IOException {
|
||||
for (ObjectCursor<LeafCollector> c : leafCollectors.values()) {
|
||||
c.value.setScorer(scorer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void collect(int docId) throws IOException {
|
||||
int doc = docId+docBase;
|
||||
|
@ -343,7 +345,7 @@ public class ExpandComponent extends SearchComponent implements PluginInfoInitia
|
|||
c.collect(docId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean acceptsDocsOutOfOrder() {
|
||||
return false;
|
||||
|
|
|
@ -114,7 +114,7 @@ public class TestExpandComponent extends SolrTestCaseJ4 {
|
|||
params.add("defType", "edismax");
|
||||
params.add("bf", "field(test_ti)");
|
||||
params.add("expand", "true");
|
||||
params.add("expand.sort", "test_tl desc");
|
||||
params.add("expand.sort", "test_tl desc, sub(1,1) asc");//the "sub()" just testing function queries
|
||||
assertQ(req(params), "*[count(/response/result/doc)=2]",
|
||||
"*[count(/response/lst[@name='expanded']/result)=2]",
|
||||
"/response/result/doc[1]/float[@name='id'][.='2.0']",
|
||||
|
|
Loading…
Reference in New Issue