Skip to content

Apache Lucene open-source search software

add empty extractTerms(): LUCENE-556

Yonik Seeley2c5bc593b824
diff --git a/CHANGES.txt b/CHANGES.txt
index 17277f21522..5c35a9eadaf 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -65,6 +65,10 @@ Bug fixes
didn't know about the field yet, reader didn't keep track if it had deletions,
and deleteDocument calls could circumvent synchronization on the subreaders.
(Chuck Williams via Yonik Seeley)
+
+14. LUCENE-556: Added empty extractTerms() implementation to MatchAllDocsQuery and
+ ConstantScoreQuery in order to allow their use with a MultiSearcher.
+ (Yonik Seeley)
1.9.1
diff --git a/src/java/org/apache/lucene/search/ConstantScoreQuery.java b/src/java/org/apache/lucene/search/ConstantScoreQuery.java
index 55455555e07..2d063908eaf 100644
--- a/src/java/org/apache/lucene/search/ConstantScoreQuery.java
+++ b/src/java/org/apache/lucene/search/ConstantScoreQuery.java
@@ -20,6 +20,7 @@ import org.apache.lucene.index.IndexReader;
import java.io.IOException;
import java.util.BitSet;
+import java.util.Set;
/**
* A query that wraps a filter and simply returns a constant score equal to the
@@ -39,6 +40,11 @@ public class ConstantScoreQuery extends Query {
return this;
}
+ public void extractTerms(Set terms) {
+ // OK to not add any terms when used for MultiSearcher,
+ // but may not be OK for highlighting
+ }
+
protected class ConstantWeight implements Weight {
private Similarity similarity;
private float queryNorm;
diff --git a/src/java/org/apache/lucene/search/MatchAllDocsQuery.java b/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
index 67405a92b96..1543d4e06d1 100644
--- a/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
+++ b/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
@@ -25,6 +25,8 @@ import org.apache.lucene.search.Similarity;
import org.apache.lucene.search.Weight;
import org.apache.lucene.util.ToStringUtils;
+import java.util.Set;
+
/**
* A query that matches all documents.
*
@@ -132,6 +134,9 @@ public class MatchAllDocsQuery extends Query {
return new MatchAllDocsWeight(searcher);
}
+ public void extractTerms(Set terms) {
+ }
+
public String toString(String field) {
StringBuffer buffer = new StringBuffer();
buffer.append("MatchAllDocsQuery");