[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndexNG - TextIndexNG.py:1.2.2.22
Andreas Jung
andreas@digicool.com
Mon, 4 Feb 2002 20:43:21 -0500
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndexNG
In directory cvs.zope.org:/tmp/cvs-serv2978
Modified Files:
Tag: ajung-textindexng-branch
TextIndexNG.py
Log Message:
added support for normalizer
=== Zope/lib/python/Products/PluginIndexes/TextIndexNG/TextIndexNG.py 1.2.2.21 => 1.2.2.22 ===
# Normalizer
+
if isinstance(self.charMapping, StringType):
self._normalizer = Normalizer.Normalizer(self.charMapping)
- elif isinstance(self.thesaurus, Normalizer.Normalizer):
- self._normalizer = self._normalizer
+ elif isinstance(self.charMapping, Normalizer.Normalizer):
+ self._normalizer = self.charMapping
else:
self._normalizer = None
# StopWords
-
if isinstance(self.stopWords, StringType):
self._stopwords = StopWords.StopWords(self.stopWords)
elif isinstance(self.stopWords, InstanceType):
@@ -197,7 +197,6 @@
else:
self._stopwords = StopWords.StopWords()
-
# Proximity
@@ -214,7 +213,8 @@
# near Search
- if self.nearSearch == 'internal':
+
+ if self.nearSearch == 'internal':
self._v_positions = self.positionsFromInternalStorage
self._v_insertForwardEntry = self.insertForwardEntryInternal
else:
@@ -222,6 +222,7 @@
self._v_insertForwardEntry = self.insertForwardEntryDocumentLookup
# get splitter function
+
self._v_splitterfunc = self._v_stemmerfunc = None
if self.useSplitter:
@@ -436,6 +437,13 @@
T("Stemmer")
+ # Normalization
+
+ if self._normalizer:
+ words = self._normalizer.normalize(words)
+
+ T("Normalizer")
+
# We pass the list of words to the corresponding lexicon
# and obtain a list of wordIds. The "old" TextIndex iterated
# over every single words (overhead).
@@ -658,9 +666,6 @@
return
-
-
-
def positionsFromDocumentLookup(self,docId, words):
""" search all positions for a list of words for