LUCENE-1849: fix FilteredQuery to pass 'true' for scoreDocsInOrder to its sub-scorer

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@807821 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-08-25 21:55:49 +00:00
parent 1a96b72fed
commit d0b93aa94c
2 changed files with 14 additions and 1 deletions

View File

@ -103,7 +103,7 @@ extends Query {
// return a filtering scorer
public Scorer scorer(IndexReader indexReader, boolean scoreDocsInOrder, boolean topScorer)
throws IOException {
final Scorer scorer = weight.scorer(indexReader, scoreDocsInOrder, false);
final Scorer scorer = weight.scorer(indexReader, true, false);
if (scorer == null) {
return null;
}

View File

@ -198,6 +198,19 @@ public class TestFilteredQuery extends LuceneTestCase {
assertEquals(0, hits.length);
QueryUtils.check(query,searcher);
}
// Make sure BooleanQuery, which does out-of-order
// scoring, inside FilteredQuery, works
public void testBoolean2() throws Exception {
BooleanQuery bq = new BooleanQuery();
Query query = new FilteredQuery(bq,
new SingleDocTestFilter(0));
bq.add(new TermQuery(new Term("field", "one")), BooleanClause.Occur.SHOULD);
bq.add(new TermQuery(new Term("field", "two")), BooleanClause.Occur.SHOULD);
ScoreDoc[] hits = searcher.search(query, 1000).scoreDocs;
assertEquals(1, hits.length);
QueryUtils.check(query,searcher);
}
}