diff --git a/solr/core/src/java/org/apache/solr/search/GraphTermsQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/GraphTermsQParserPlugin.java index 01dfa2d08f4..05a4c32b64e 100644 --- a/solr/core/src/java/org/apache/solr/search/GraphTermsQParserPlugin.java +++ b/solr/core/src/java/org/apache/solr/search/GraphTermsQParserPlugin.java @@ -100,8 +100,6 @@ public class GraphTermsQParserPlugin extends QParserPlugin { private class GraphTermsQuery extends Query implements ExtendedQuery { private Term[] queryTerms; - private List finalContexts; - private List finalTerms; private String field; private int maxDocFreq; private Object id; @@ -147,19 +145,6 @@ public class GraphTermsQParserPlugin extends QParserPlugin { @Override public Query rewrite(IndexReader reader) throws IOException { - this.finalContexts = new ArrayList(); - this.finalTerms = new ArrayList(); - List contexts = reader.leaves(); - TermContext[] termContexts = new TermContext[this.queryTerms.length]; - collectTermContext(reader, contexts, termContexts, this.queryTerms); - for(int i=0; i finalContexts = new ArrayList(); + List finalTerms = new ArrayList(); + List contexts = searcher.getTopReaderContext().leaves(); + TermContext[] termContexts = new TermContext[this.queryTerms.length]; + collectTermContext(searcher.getIndexReader(), contexts, termContexts, this.queryTerms); + for(int i=0; i