Apache Lucene open-source search software
LUCENE-6761: MatchAllDocsQuery's Scorers do not expose approximations anymore.
Adrien Grand3bab6026b13a
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 00ed921d8f2..407b64ab0a5 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -119,6 +119,9 @@ Other* LUCENE-6768: AbstractFirstPassGroupingCollector.groupSort private memberis not needed. (Christine Poerschke)+* LUCENE-6761: MatchAllDocsQuery's Scorers do not expose approximations+ anymore. (Adrien Grand)+Build* LUCENE-6732: Improve checker for invalid source patterns to alsodiff --git a/lucene/core/src/java/org/apache/lucene/search/MatchAllDocsQuery.java b/lucene/core/src/java/org/apache/lucene/search/MatchAllDocsQuery.javaindex d528b36b1b2..e67a95ea6e5 100644--- a/lucene/core/src/java/org/apache/lucene/search/MatchAllDocsQuery.java+++ b/lucene/core/src/java/org/apache/lucene/search/MatchAllDocsQuery.java@@ -31,16 +31,16 @@ public final class MatchAllDocsQuery extends Query {@Overridepublic Weight createWeight(IndexSearcher searcher, boolean needsScores) {- return new RandomAccessWeight(this) {- @Override- protected Bits getMatchingDocs(LeafReaderContext context) throws IOException {- return new Bits.MatchAllBits(context.reader().maxDoc());- }+ return new ConstantScoreWeight(this) {@Overridepublic String toString() {return "weight(" + MatchAllDocsQuery.this + ")";}@Override+ public Scorer scorer(LeafReaderContext context) throws IOException {+ return new ConstantScoreScorer(this, score(), DocIdSetIterator.all(context.reader().maxDoc()));+ }+ @Overridepublic BulkScorer bulkScorer(LeafReaderContext context) throws IOException {final float score = score();final int maxDoc = context.reader().maxDoc();