lucene-pylucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject svn commit: r1421667 - /lucene/pylucene/trunk/test/test_PrefixQuery.py
Date Fri, 14 Dec 2012 04:24:47 GMT
Author: vajda
Date: Fri Dec 14 04:24:46 2012
New Revision: 1421667

URL: http://svn.apache.org/viewvc?rev=1421667&view=rev
Log:
migrated test_PrefixQuery.py

Modified:
    lucene/pylucene/trunk/test/test_PrefixQuery.py

Modified: lucene/pylucene/trunk/test/test_PrefixQuery.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/test/test_PrefixQuery.py?rev=1421667&r1=1421666&r2=1421667&view=diff
==============================================================================
--- lucene/pylucene/trunk/test/test_PrefixQuery.py (original)
+++ lucene/pylucene/trunk/test/test_PrefixQuery.py Fri Dec 14 04:24:46 2012
@@ -13,25 +13,27 @@
 # ====================================================================
 
 from unittest import TestCase, main
-from lucene import *
+from PyLuceneTestCase import PyLuceneTestCase
 
+from org.apache.lucene.document import Document, StringField
+from org.apache.lucene.index import Term
+from org.apache.lucene.search import PrefixQuery
 
-class PrefixQueryTestCase(TestCase):
+
+class PrefixQueryTestCase(PyLuceneTestCase):
     """
     Unit tests ported from Java Lucene
     """
 
     def testPrefixQuery(self):
 
-        directory = RAMDirectory()
+        writer = self.getWriter()
 
         categories = ["/Computers", "/Computers/Mac", "/Computers/Windows"]
-        writer = IndexWriter(directory, WhitespaceAnalyzer(), True,
-                             IndexWriter.MaxFieldLength.LIMITED)
         for category in categories:
             doc = Document()
-            doc.add(Field("category", category,
-                          Field.Store.YES, Field.Index.NOT_ANALYZED))
+            doc.add(self.newField("category", category,
+                                  StringField.TYPE_STORED))
             writer.addDocument(doc)
 
         writer.close()



Mime
View raw message