SOLR-5536: Added a proper ValueSource context

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1566754 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Joel Bernstein 2014-02-10 21:33:50 +00:00
parent af740da71c
commit b2d66a6019
1 changed files with 6 additions and 6 deletions

View File

@ -53,7 +53,6 @@ import java.util.Arrays;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.HashSet; import java.util.HashSet;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Iterator; import java.util.Iterator;
@ -325,7 +324,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
this.needsScores, this.needsScores,
fieldType, fieldType,
boostDocs, boostDocs,
funcQuery); funcQuery, searcher);
} else { } else {
return new CollapsingScoreCollector(maxDoc, leafCount, docValues, this.nullPolicy, boostDocs); return new CollapsingScoreCollector(maxDoc, leafCount, docValues, this.nullPolicy, boostDocs);
} }
@ -560,7 +559,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
boolean needsScores, boolean needsScores,
FieldType fieldType, FieldType fieldType,
IntOpenHashSet boostDocs, IntOpenHashSet boostDocs,
FunctionQuery funcQuery) throws IOException{ FunctionQuery funcQuery, IndexSearcher searcher) throws IOException{
this.maxDoc = maxDoc; this.maxDoc = maxDoc;
this.contexts = new AtomicReaderContext[segments]; this.contexts = new AtomicReaderContext[segments];
@ -570,7 +569,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
this.needsScores = needsScores; this.needsScores = needsScores;
this.boostDocs = boostDocs; this.boostDocs = boostDocs;
if(funcQuery != null) { if(funcQuery != null) {
this.fieldValueCollapse = new ValueSourceCollapse(maxDoc, field, nullPolicy, new int[valueCount], max, this.needsScores, boostDocs, funcQuery); this.fieldValueCollapse = new ValueSourceCollapse(maxDoc, field, nullPolicy, new int[valueCount], max, this.needsScores, boostDocs, funcQuery, searcher);
} else { } else {
if(fieldType instanceof TrieIntField) { if(fieldType instanceof TrieIntField) {
this.fieldValueCollapse = new IntValueCollapse(maxDoc, field, nullPolicy, new int[valueCount], max, this.needsScores, boostDocs); this.fieldValueCollapse = new IntValueCollapse(maxDoc, field, nullPolicy, new int[valueCount], max, this.needsScores, boostDocs);
@ -940,7 +939,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
private ValueSource valueSource; private ValueSource valueSource;
private FunctionValues functionValues; private FunctionValues functionValues;
private float[] ordVals; private float[] ordVals;
private Map rcontext = new HashMap(); private Map rcontext;
private CollapseScore collapseScore = new CollapseScore(); private CollapseScore collapseScore = new CollapseScore();
private float score; private float score;
private boolean cscore; private boolean cscore;
@ -952,9 +951,10 @@ public class CollapsingQParserPlugin extends QParserPlugin {
boolean max, boolean max,
boolean needsScores, boolean needsScores,
IntOpenHashSet boostDocs, IntOpenHashSet boostDocs,
FunctionQuery funcQuery) throws IOException { FunctionQuery funcQuery, IndexSearcher searcher) throws IOException {
super(maxDoc, null, nullPolicy, max, needsScores, boostDocs); super(maxDoc, null, nullPolicy, max, needsScores, boostDocs);
this.valueSource = funcQuery.getValueSource(); this.valueSource = funcQuery.getValueSource();
this.rcontext = ValueSource.newContext(searcher);
this.ords = ords; this.ords = ords;
this.ordVals = new float[ords.length]; this.ordVals = new float[ords.length];
Arrays.fill(ords, -1); Arrays.fill(ords, -1);