From 2c5bc593b8248240f830bbbd424a6f1bd267ff6e Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Fri, 19 May 2006 20:29:09 +0000 Subject: [PATCH] add empty extractTerms(): LUCENE-556 git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@407903 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 4 ++++ src/java/org/apache/lucene/search/ConstantScoreQuery.java | 6 ++++++ src/java/org/apache/lucene/search/MatchAllDocsQuery.java | 5 +++++ 3 files changed, 15 insertions(+) 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");