[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndex - GlobbingLexicon.py:1.4
Andreas Jung
andreas@zope.com
Thu, 11 Oct 2001 10:39:09 -0400
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndex
In directory cvs.zope.org:/tmp/cvs-serv26933
Modified Files:
GlobbingLexicon.py
Log Message:
queries with single-letter words produced a slicing error in get()
=== Zope/lib/python/Products/PluginIndexes/TextIndex/GlobbingLexicon.py 1.3 => 1.4 ===
from Lexicon import Lexicon
import Splitter
-from TextIndex import Or, Op
+
import re, string
@@ -95,6 +95,10 @@
from BTrees.OOBTree import OOBTree
from randid import randid
+from Products.PluginIndexes.TextIndex.TextIndex import Or
+from Products.PluginIndexes.TextIndex.TextIndex import Op
+
+
class GlobbingLexicon(Lexicon):
"""Lexicon which supports basic globbing function ('*' and '?').
@@ -210,6 +214,13 @@
def get(self, pattern):
""" Query the lexicon for words matching a pattern."""
+
+ # single word pattern produce a slicing problem below.
+ # Because the splitter throws away single characters we can
+ # return an empty tuple here.
+
+ if len(pattern)==1: return ()
+
wc_set = [self.multi_wc, self.single_wc]
digrams = []