lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r709459 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/search/DocIdSet.java src/java/org/apache/lucene/search/QueryWrapperFilter.java
Date Fri, 31 Oct 2008 16:18:13 GMT
Author: mikemccand
Date: Fri Oct 31 09:18:13 2008
New Revision: 709459

URL: http://svn.apache.org/viewvc?rev=709459&view=rev
Log:
LUCENE-1427: speed up QueryWrapperFilter by not computing scores nor an intermediate OpenBitSet

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSet.java
    lucene/java/trunk/src/java/org/apache/lucene/search/QueryWrapperFilter.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=709459&r1=709458&r2=709459&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Fri Oct 31 09:18:13 2008
@@ -12,6 +12,9 @@
    Yet, it will give us the possibility to try out different consumers in
    in the chain. (Michael Busch)
 
+2. LUCENE-1427: DocIdSet.iterator() is now allowed to throw
+   IOException.  (Paul Elschot, Mike McCandless)
+
 Bug fixes
 
 1. LUCENE-1415: MultiPhraseQuery has incorrect hashCode() and equals()
@@ -38,6 +41,12 @@
 
 Optimizations
 
+ 1. LUCENE-1427: Fixed QueryWrapperFilter to not waste time computing
+    scores of the query, since they are just discarded.  Also, made it
+    more efficient (single pass) by not creating & populating an
+    intermediate OpenBitSet (Paul Elschot, Mike McCandless)
+
+
 Documentation
 
 Build

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSet.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSet.java?rev=709459&r1=709458&r2=709459&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSet.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/DocIdSet.java Fri Oct 31 09:18:13
2008
@@ -17,11 +17,12 @@
  * limitations under the License.
  */
 
+import java.io.IOException;
 
 /**
  * A DocIdSet contains a set of doc ids. Implementing classes must provide
  * a {@link DocIdSetIterator} to access the set. 
  */
 public abstract class DocIdSet {
-	public abstract DocIdSetIterator iterator();
+	public abstract DocIdSetIterator iterator() throws IOException;
 }

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/QueryWrapperFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/QueryWrapperFilter.java?rev=709459&r1=709458&r2=709459&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/QueryWrapperFilter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/QueryWrapperFilter.java Fri Oct 31
09:18:13 2008
@@ -59,15 +59,13 @@
     return bits;
   }
   
-  public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
-    final OpenBitSet bits = new OpenBitSet(reader.maxDoc());
-
-    new IndexSearcher(reader).search(query, new HitCollector() {
-      public final void collect(int doc, float score) {
-        bits.set(doc);  // set bit for hit
+  public DocIdSet getDocIdSet(final IndexReader reader) throws IOException {
+    final Weight weight = query.weight(new IndexSearcher(reader));
+    return new DocIdSet() {
+      public DocIdSetIterator iterator() throws IOException {
+        return weight.scorer(reader);
       }
-    });
-    return bits;
+    };
   }
 
   public String toString() {



Mime
View raw message