From b2d66a60198ff757bfcff3ba94bb5ea4c16f2d28 Mon Sep 17 00:00:00 2001 From: Joel Bernstein Date: Mon, 10 Feb 2014 21:33:50 +0000 Subject: [PATCH] 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 --- .../apache/solr/search/CollapsingQParserPlugin.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java index 4618104875c..84934842cd8 100644 --- a/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java +++ b/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java @@ -53,7 +53,6 @@ import java.util.Arrays; import java.util.Map; import java.util.Set; import java.util.HashSet; -import java.util.HashMap; import java.util.List; import java.util.Iterator; @@ -325,7 +324,7 @@ public class CollapsingQParserPlugin extends QParserPlugin { this.needsScores, fieldType, boostDocs, - funcQuery); + funcQuery, searcher); } else { return new CollapsingScoreCollector(maxDoc, leafCount, docValues, this.nullPolicy, boostDocs); } @@ -560,7 +559,7 @@ public class CollapsingQParserPlugin extends QParserPlugin { boolean needsScores, FieldType fieldType, IntOpenHashSet boostDocs, - FunctionQuery funcQuery) throws IOException{ + FunctionQuery funcQuery, IndexSearcher searcher) throws IOException{ this.maxDoc = maxDoc; this.contexts = new AtomicReaderContext[segments]; @@ -570,7 +569,7 @@ public class CollapsingQParserPlugin extends QParserPlugin { this.needsScores = needsScores; this.boostDocs = boostDocs; 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 { if(fieldType instanceof TrieIntField) { 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 FunctionValues functionValues; private float[] ordVals; - private Map rcontext = new HashMap(); + private Map rcontext; private CollapseScore collapseScore = new CollapseScore(); private float score; private boolean cscore; @@ -952,9 +951,10 @@ public class CollapsingQParserPlugin extends QParserPlugin { boolean max, boolean needsScores, IntOpenHashSet boostDocs, - FunctionQuery funcQuery) throws IOException { + FunctionQuery funcQuery, IndexSearcher searcher) throws IOException { super(maxDoc, null, nullPolicy, max, needsScores, boostDocs); this.valueSource = funcQuery.getValueSource(); + this.rcontext = ValueSource.newContext(searcher); this.ords = ords; this.ordVals = new float[ords.length]; Arrays.fill(ords, -1);