lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r807821 - in /lucene/java/trunk/src: java/org/apache/lucene/search/FilteredQuery.java test/org/apache/lucene/search/TestFilteredQuery.java
Date Tue, 25 Aug 2009 21:55:49 GMT
Author: mikemccand
Date: Tue Aug 25 21:55:49 2009
New Revision: 807821

URL: http://svn.apache.org/viewvc?rev=807821&view=rev
Log:
LUCENE-1849: fix FilteredQuery to pass 'true' for scoreDocsInOrder to its sub-scorer

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/FilteredQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestFilteredQuery.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/FilteredQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/FilteredQuery.java?rev=807821&r1=807820&r2=807821&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/FilteredQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/FilteredQuery.java Tue Aug 25 21:55:49
2009
@@ -103,7 +103,7 @@
       // 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;
         }

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestFilteredQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestFilteredQuery.java?rev=807821&r1=807820&r2=807821&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestFilteredQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestFilteredQuery.java Tue Aug 25
21:55:49 2009
@@ -198,6 +198,19 @@
     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);    
+  }
 }
 
 



Mime
View raw message