lucene-pylucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject svn commit: r993543 - in /lucene/pylucene/trunk/samples/LuceneInAction/lia: advsearching/BooksLikeThis.py indexing/DocumentDeleteTest.py
Date Tue, 07 Sep 2010 21:53:18 GMT
Author: vajda
Date: Tue Sep  7 21:53:17 2010
New Revision: 993543

URL: http://svn.apache.org/viewvc?rev=993543&view=rev
Log:
reflected isDeleted() api change

Modified:
    lucene/pylucene/trunk/samples/LuceneInAction/lia/advsearching/BooksLikeThis.py
    lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/DocumentDeleteTest.py

Modified: lucene/pylucene/trunk/samples/LuceneInAction/lia/advsearching/BooksLikeThis.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/samples/LuceneInAction/lia/advsearching/BooksLikeThis.py?rev=993543&r1=993542&r2=993543&view=diff
==============================================================================
--- lucene/pylucene/trunk/samples/LuceneInAction/lia/advsearching/BooksLikeThis.py (original)
+++ lucene/pylucene/trunk/samples/LuceneInAction/lia/advsearching/BooksLikeThis.py Tue Sep
 7 21:53:17 2010
@@ -16,7 +16,7 @@ import os
 
 from lucene import \
      Document, IndexReader, Term, BooleanQuery, IndexSearcher, TermQuery, \
-     SimpleFSDirectory, File, System, BooleanClause
+     SimpleFSDirectory, File, System, BooleanClause, MultiFields
 
 
 class BooksLikeThis(object):
@@ -28,9 +28,10 @@ class BooksLikeThis(object):
 
         reader = IndexReader.open(directory, True)
         blt = BooksLikeThis(reader)
+        deletedDocs = MultiFields.getDeletedDocs(reader)
 
         for id in xrange(reader.maxDoc()):
-            if reader.isDeleted(id):
+            if deletedDocs is not None and deletedDocs.get(id):
                 continue
             doc = reader.document(id)
             print ''

Modified: lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/DocumentDeleteTest.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/DocumentDeleteTest.py?rev=993543&r1=993542&r2=993543&view=diff
==============================================================================
--- lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/DocumentDeleteTest.py (original)
+++ lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/DocumentDeleteTest.py Tue Sep
 7 21:53:17 2010
@@ -12,7 +12,7 @@
 #   limitations under the License.
 # ====================================================================
 
-from lucene import IndexWriter, IndexReader
+from lucene import IndexWriter, IndexReader, MultiFields
 from lia.indexing.BaseIndexingTestCase import BaseIndexingTestCase
 
 
@@ -23,9 +23,11 @@ class DocumentDeleteTest(BaseIndexingTes
         reader = IndexReader.open(self.dir, False)
         self.assertEqual(2, reader.maxDoc())
         self.assertEqual(2, reader.numDocs())
+
         reader.deleteDocument(1)
+        deletedDocs = MultiFields.getDeletedDocs(reader)
 
-        self.assert_(reader.isDeleted(1))
+        self.assert_(deletedDocs is not None and deletedDocs.get(1))
         self.assert_(reader.hasDeletions())
         self.assertEqual(2, reader.maxDoc())
         self.assertEqual(1, reader.numDocs())
@@ -53,8 +55,9 @@ class DocumentDeleteTest(BaseIndexingTes
         writer.close()
 
         reader = IndexReader.open(self.dir, True)
+        deletedDocs = MultiFields.getDeletedDocs(reader)
 
-        self.assert_(not reader.isDeleted(1))
+        self.assert_(deletedDocs is None or not deletedDocs.get(1))
         self.assert_(not reader.hasDeletions())
         self.assertEqual(1, reader.maxDoc())
         self.assertEqual(1, reader.numDocs())



Mime
View raw message