Skip to content

Apache Lucene open-source search software

remove searcher reference from MatchAllDocsQuery so it's Serializable

Yonik Seeley025936b4aeff
diff --git a/CHANGES.txt b/CHANGES.txt
index 4223f2c5691..511233925d4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -35,6 +35,8 @@ Bug fixes
4. LUCENE-587: Explanation.toHtml was producing malformed HTML
(Chris Hostetter)
+
+ 5. Fix to allow MatchAllDocsQuery to be used with RemoteSearcher (Yonik Seeley)
Optimizations
diff --git a/src/java/org/apache/lucene/search/MatchAllDocsQuery.java b/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
index 1543d4e06d1..402aeaf4be3 100644
--- a/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
+++ b/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
@@ -82,12 +82,12 @@ public class MatchAllDocsQuery extends Query {
}
private class MatchAllDocsWeight implements Weight {
- private Searcher searcher;
+ private Similarity similarity;
private float queryWeight;
private float queryNorm;
public MatchAllDocsWeight(Searcher searcher) {
- this.searcher = searcher;
+ this.similarity = searcher.getSimilarity();
}
public String toString() {
@@ -113,7 +113,7 @@ public class MatchAllDocsQuery extends Query {
}
public Scorer scorer(IndexReader reader) {
- return new MatchAllScorer(reader, getSimilarity(searcher), this);
+ return new MatchAllScorer(reader, similarity, this);
}
public Explanation explain(IndexReader reader, int doc) {