mirror of https://github.com/apache/lucene.git
LUCENE-4327: Use BooleanScorer1 for filter-down-low queries
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1377050 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
db48cd84ec
commit
78b9c425e3
|
@ -115,6 +115,9 @@ Optimizations
|
|||
* LUCENE-4317: Improve reuse of internal TokenStreams and StringReader
|
||||
in oal.document.Field. (Uwe Schindler, Chris Male, Robert Muir)
|
||||
|
||||
* LUCENE-4327: Support out-of-order scoring in FilteredQuery for higher
|
||||
performance. (Mike McCandless, Robert Muir)
|
||||
|
||||
Build
|
||||
|
||||
* LUCENE-3985: Upgrade to randomizedtesting 2.0.0. Added support for
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.lucene.index.AtomicReaderContext;
|
||||
import org.apache.lucene.search.BooleanClause.Occur;
|
||||
import org.apache.lucene.search.BooleanQuery.BooleanWeight;
|
||||
|
||||
/* Description from Doug Cutting (excerpted from
|
||||
|
@ -115,7 +114,7 @@ final class BooleanScorer extends Scorer {
|
|||
// Therefore the only methods that are implemented are score() and doc().
|
||||
private static final class BucketScorer extends Scorer {
|
||||
|
||||
float score;
|
||||
double score;
|
||||
int doc = NO_MORE_DOCS;
|
||||
int freq;
|
||||
|
||||
|
@ -134,13 +133,13 @@ final class BooleanScorer extends Scorer {
|
|||
public int nextDoc() { return NO_MORE_DOCS; }
|
||||
|
||||
@Override
|
||||
public float score() { return score; }
|
||||
public float score() { return (float)score; }
|
||||
|
||||
}
|
||||
|
||||
static final class Bucket {
|
||||
int doc = -1; // tells if bucket is valid
|
||||
float score; // incremental score
|
||||
double score; // incremental score
|
||||
// TODO: break out bool anyProhibited, int
|
||||
// numRequiredMatched; then we can remove 32 limit on
|
||||
// required clauses
|
||||
|
|
|
@ -129,6 +129,7 @@ class ConjunctionScorer extends Scorer {
|
|||
|
||||
@Override
|
||||
public float score() throws IOException {
|
||||
// TODO: sum into a double and cast to float if we ever send required clauses to BS1
|
||||
float sum = 0.0f;
|
||||
for (int i = 0; i < scorers.length; i++) {
|
||||
sum += scorers[i].score();
|
||||
|
|
|
@ -90,6 +90,7 @@ class ConjunctionTermScorer extends Scorer {
|
|||
|
||||
@Override
|
||||
public float score() throws IOException {
|
||||
// TODO: sum into a double and cast to float if we ever send required clauses to BS1
|
||||
float sum = 0.0f;
|
||||
for (DocsAndFreqs docs : docsAndFreqs) {
|
||||
sum += docs.scorer.score();
|
||||
|
|
|
@ -83,9 +83,7 @@ public class FilteredQuery extends Query {
|
|||
|
||||
@Override
|
||||
public boolean scoresDocsOutOfOrder() {
|
||||
// TODO: Support out-of-order scoring!
|
||||
// For now we return false here, as we always get the scorer in order
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -148,9 +146,7 @@ public class FilteredQuery extends Query {
|
|||
|
||||
if (useRandomAccess) {
|
||||
// if we are using random access, we return the inner scorer, just with other acceptDocs
|
||||
// TODO, replace this by when BooleanWeight is fixed to be consistent with its scorer implementations:
|
||||
// return weight.scorer(context, scoreDocsInOrder, topScorer, filterAcceptDocs);
|
||||
return weight.scorer(context, true, topScorer, filterAcceptDocs);
|
||||
return weight.scorer(context, scoreDocsInOrder, topScorer, filterAcceptDocs);
|
||||
} else {
|
||||
assert firstFilterDoc > -1;
|
||||
// we are gonna advance() this scorer, so we set inorder=true/toplevel=false
|
||||
|
|
|
@ -69,6 +69,7 @@ class ReqOptSumScorer extends Scorer {
|
|||
*/
|
||||
@Override
|
||||
public float score() throws IOException {
|
||||
// TODO: sum into a double and cast to float if we ever send required clauses to BS1
|
||||
int curDoc = reqScorer.docID();
|
||||
float reqScore = reqScorer.score();
|
||||
if (optScorer == null) {
|
||||
|
|
Loading…
Reference in New Issue