lucene-pylucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject svn commit: r1757692 - /lucene/pylucene/trunk/test/test_Highlighter.py
Date Thu, 25 Aug 2016 14:34:25 GMT
Author: vajda
Date: Thu Aug 25 14:34:25 2016
New Revision: 1757692

URL: http://svn.apache.org/viewvc?rev=1757692&view=rev
Log:
test_Highlighter.py passes

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

Modified: lucene/pylucene/trunk/test/test_Highlighter.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/test/test_Highlighter.py?rev=1757692&r1=1757691&r2=1757692&view=diff
==============================================================================
--- lucene/pylucene/trunk/test/test_Highlighter.py (original)
+++ lucene/pylucene/trunk/test/test_Highlighter.py Thu Aug 25 14:34:25 2016
@@ -21,7 +21,6 @@ from org.apache.lucene.document import D
 from org.apache.lucene.queryparser.classic import QueryParser
 from org.apache.lucene.search.highlight import \
     Highlighter, QueryScorer, SimpleFragmenter
-from org.apache.lucene.util import Version
 from org.apache.pylucene.search.highlight import PythonFormatter
 
 
@@ -34,11 +33,11 @@ class TestFormatter(PythonFormatter):
     def highlightTerm(self, originalText, group):
         if group.getTotalScore() <= 0:
             return originalText;
-        
+
         self.testCase.countHighlightTerm()
-        
+
         return "<b>" + originalText + "</b>"
-    
+
 
 class HighlighterTestCase(PyLuceneTestCase):
     """
@@ -56,13 +55,12 @@ class HighlighterTestCase(PyLuceneTestCa
     def __init__(self, *args):
         super(HighlighterTestCase, self).__init__(*args)
 
-        self.parser = QueryParser(Version.LUCENE_CURRENT, self.FIELD_NAME,
-                                  StandardAnalyzer(Version.LUCENE_CURRENT))
+        self.parser = QueryParser(self.FIELD_NAME, StandardAnalyzer())
 
     def setUp(self):
         super(HighlighterTestCase, self).setUp()
 
-        self.analyzer = StandardAnalyzer(Version.LUCENE_CURRENT)
+        self.analyzer = StandardAnalyzer()
 
         writer = self.getWriter(analyzer=self.analyzer)
         for text in self.texts:
@@ -100,7 +98,7 @@ class HighlighterTestCase(PyLuceneTestCa
         self.assert_(self.numHighlights == 3,
                      ("Failed to find correct number of highlights, %d found"
                       %(self.numHighlights)))
-        
+
     def doSearching(self, queryString):
 
         self.searcher = self.getSearcher()
@@ -114,9 +112,9 @@ class HighlighterTestCase(PyLuceneTestCa
         self.numHighlights = 0
 
     def doStandardHighlights(self):
-        
+
         formatter = TestFormatter(self)
-        
+
         highlighter = Highlighter(formatter, QueryScorer(self.query))
         highlighter.setTextFragmenter(SimpleFragmenter(20))
         for scoreDoc in self.scoreDocs:
@@ -131,11 +129,11 @@ class HighlighterTestCase(PyLuceneTestCa
                                                   maxNumFragmentsRequired,
                                                   fragmentSeparator)
             print "\t", result
-            
+
     def countHighlightTerm(self):
 
         self.numHighlights += 1 # update stats used in assertions
-        
+
     def addDoc(self, writer, text):
 
         d = Document()
@@ -143,7 +141,7 @@ class HighlighterTestCase(PyLuceneTestCa
 
         d.add(f)
         writer.addDocument(d)
-        
+
 
 if __name__ == "__main__":
     lucene.initVM(vmargs=['-Djava.awt.headless=true'])



Mime
View raw message