lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r701438 - /lucene/java/branches/lucene_2_4/contrib/queries/src/java/org/apache/lucene/search/TermsFilter.java
Date Fri, 03 Oct 2008 16:41:46 GMT
Author: mikemccand
Date: Fri Oct  3 09:41:46 2008
New Revision: 701438

URL: http://svn.apache.org/viewvc?rev=701438&view=rev
Log:
merging rev 700815 (NPE in TermsFilter.bits) to 2.4 branch

Modified:
    lucene/java/branches/lucene_2_4/contrib/queries/src/java/org/apache/lucene/search/TermsFilter.java

Modified: lucene/java/branches/lucene_2_4/contrib/queries/src/java/org/apache/lucene/search/TermsFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_4/contrib/queries/src/java/org/apache/lucene/search/TermsFilter.java?rev=701438&r1=701437&r2=701438&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_4/contrib/queries/src/java/org/apache/lucene/search/TermsFilter.java
(original)
+++ lucene/java/branches/lucene_2_4/contrib/queries/src/java/org/apache/lucene/search/TermsFilter.java
Fri Oct  3 09:41:46 2008
@@ -48,8 +48,38 @@
 	{
 		terms.add(term);
 	}
+	
+	
 
 	/* (non-Javadoc)
+	 * @see org.apache.lucene.search.Filter#bits(org.apache.lucene.index.IndexReader)
+	 */
+	public BitSet bits(IndexReader reader) throws IOException
+	{
+		BitSet result=new BitSet(reader.maxDoc());
+        TermDocs td = reader.termDocs();
+        try
+        {
+            for (Iterator iter = terms.iterator(); iter.hasNext();)
+            {
+                Term term = (Term) iter.next();
+                td.seek(term);
+                while (td.next())
+                {
+                    result.set(td.doc());
+                }
+            }
+        }
+        finally
+        {
+            td.close();
+        }
+        return result;
+	}
+
+
+
+/* (non-Javadoc)
    * @see org.apache.lucene.search.Filter#getDocIdSet(org.apache.lucene.index.IndexReader)
 	 */
   public DocIdSet getDocIdSet(IndexReader reader) throws IOException



Mime
View raw message