[Zope-Checkins] SVN: Zope/branches/2.12/ LP #142478: normalize terms passed to ``PLexicon.queryLexicon``
Tres Seaver
tseaver at palladion.com
Mon Apr 12 08:26:44 EDT 2010
Log message for revision 110742:
LP #142478: normalize terms passed to ``PLexicon.queryLexicon``
o Use the lexicon's pipeline (e.g., case flattening, stop word removal, etc.).
Changed:
U Zope/branches/2.12/doc/CHANGES.rst
U Zope/branches/2.12/src/Products/ZCTextIndex/ZCTextIndex.py
U Zope/branches/2.12/src/Products/ZCTextIndex/tests/testZCTextIndex.py
-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.12/doc/CHANGES.rst 2010-04-12 12:26:42 UTC (rev 110741)
+++ Zope/branches/2.12/doc/CHANGES.rst 2010-04-12 12:26:43 UTC (rev 110742)
@@ -8,7 +8,13 @@
2.12.5 (unreleased)
-------------------
+Bugs Fixed
+++++++++++
+- LP #142478: normalize terms passed to ``PLexicon.queryLexicon`` using
+ the lexicon's pipeline (e.g., case flattening, stop word removal, etc.)
+
+
2.12.4 (2010-04-05)
-------------------
Modified: Zope/branches/2.12/src/Products/ZCTextIndex/ZCTextIndex.py
===================================================================
--- Zope/branches/2.12/src/Products/ZCTextIndex/ZCTextIndex.py 2010-04-12 12:26:42 UTC (rev 110741)
+++ Zope/branches/2.12/src/Products/ZCTextIndex/ZCTextIndex.py 2010-04-12 12:26:43 UTC (rev 110742)
@@ -358,7 +358,7 @@
"""
if words:
wids = []
- for word in words:
+ for word in self.parseTerms(words):
wids.extend(self.globToWordIds(word))
words = [self.get_word(wid) for wid in wids]
else:
Modified: Zope/branches/2.12/src/Products/ZCTextIndex/tests/testZCTextIndex.py
===================================================================
--- Zope/branches/2.12/src/Products/ZCTextIndex/tests/testZCTextIndex.py 2010-04-12 12:26:42 UTC (rev 110741)
+++ Zope/branches/2.12/src/Products/ZCTextIndex/tests/testZCTextIndex.py 2010-04-12 12:26:43 UTC (rev 110742)
@@ -691,7 +691,22 @@
self.assertEqual(list(info['page_range']), [0])
self.assertEqual(info['page_columns'], [['aaa', 'bbb']])
+ def test_queryLexicon_uses_pipeline_for_normalization(self):
+ from Products.ZCTextIndex.Lexicon import CaseNormalizer
+ WORDS = 'aaa bbb ccc ddd eee fff ggg'.split()
+ lexicon = self._makeOne('test', 'Testing', CaseNormalizer())
+ lexicon.sourceToWordIds(WORDS)
+ info = lexicon.queryLexicon(REQUEST=None, words=['AA*', 'Bbb*'])
+ self.assertEqual(info['page'], 0)
+ self.assertEqual(info['rows'], 20)
+ self.assertEqual(info['cols'], 4)
+ self.assertEqual(info['start_word'], 1)
+ self.assertEqual(info['end_word'], 2)
+ self.assertEqual(info['word_count'], 2)
+ self.assertEqual(list(info['page_range']), [0])
+ self.assertEqual(info['page_columns'], [['aaa', 'bbb']])
+
def test_suite():
s = unittest.TestSuite()
for klass in (CosineIndexTests, OkapiIndexTests,
More information about the Zope-Checkins
mailing list