LUCENE-6761: MatchAllDocsQuery's Scorers do not expose approximations anymore.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1700754 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrien Grand 2015-09-02 10:18:35 +00:00
parent 51510e2274
commit 3bab6026b1
2 changed files with 8 additions and 5 deletions

View File

@ -119,6 +119,9 @@ Other
* LUCENE-6768: AbstractFirstPassGroupingCollector.groupSort private member * LUCENE-6768: AbstractFirstPassGroupingCollector.groupSort private member
is not needed. (Christine Poerschke) is not needed. (Christine Poerschke)
* LUCENE-6761: MatchAllDocsQuery's Scorers do not expose approximations
anymore. (Adrien Grand)
Build Build
* LUCENE-6732: Improve checker for invalid source patterns to also * LUCENE-6732: Improve checker for invalid source patterns to also

View File

@ -31,16 +31,16 @@ public final class MatchAllDocsQuery extends Query {
@Override @Override
public Weight createWeight(IndexSearcher searcher, boolean needsScores) { public Weight createWeight(IndexSearcher searcher, boolean needsScores) {
return new RandomAccessWeight(this) { return new ConstantScoreWeight(this) {
@Override
protected Bits getMatchingDocs(LeafReaderContext context) throws IOException {
return new Bits.MatchAllBits(context.reader().maxDoc());
}
@Override @Override
public String toString() { public String toString() {
return "weight(" + MatchAllDocsQuery.this + ")"; return "weight(" + MatchAllDocsQuery.this + ")";
} }
@Override @Override
public Scorer scorer(LeafReaderContext context) throws IOException {
return new ConstantScoreScorer(this, score(), DocIdSetIterator.all(context.reader().maxDoc()));
}
@Override
public BulkScorer bulkScorer(LeafReaderContext context) throws IOException { public BulkScorer bulkScorer(LeafReaderContext context) throws IOException {
final float score = score(); final float score = score();
final int maxDoc = context.reader().maxDoc(); final int maxDoc = context.reader().maxDoc();