[Zope-Checkins] CVS: Zope2 - TextIndex.py:1.28.8.1
Andreas Jung
andreas@dhcp165.digicool.com
Wed, 18 Apr 2001 10:35:11 -0400
Update of /cvs-repository/Zope2/lib/python/SearchIndex
In directory yetix:/work/sandboxes/ajung-2_4-ts_regex-exterminiation-branch/lib/python/SearchIndex
Modified Files:
Tag: ajung-2_4-ts_regex-exterminiation-branch
TextIndex.py
Log Message:
ts_regex/regex free zone
--- Updated File TextIndex.py in package Zope2 --
--- TextIndex.py 2001/03/27 14:58:20 1.28
+++ TextIndex.py 2001/04/18 14:35:07 1.28.8.1
@@ -212,7 +212,7 @@
import operator
from Splitter import Splitter
from string import strip
-import string, ts_regex, regex
+import string, re
from Lexicon import Lexicon, stop_word_dict
from ResultList import ResultList
@@ -463,7 +463,7 @@
def query(s, index, default_operator = Or,
ws = (string.whitespace,)):
# First replace any occurences of " and not " with " andnot "
- s = ts_regex.gsub('[%s]+and[%s]+not[%s]+' % (ws * 3), ' andnot ', s)
+ s = re.sub('[%s]+and[%s]+not[%s]+' % (ws * 3), ' andnot ', s)
q = parse(s)
q = parse2(q, default_operator)
return evaluate(q, index)
@@ -515,13 +515,13 @@
return q
-def parens(s, parens_re = regex.compile('(\|)').search):
+def parens(s, parens_re = re.compile('(\|)').search):
index=open_index=paren_count = 0
while 1:
index = parens_re(s, index)
- if index < 0 : break
+ if index is None : break
if s[index] == '(':
paren_count = paren_count + 1
@@ -543,7 +543,7 @@
def quotes(s, ws = (string.whitespace,)):
# split up quoted regions
- splitted = ts_regex.split(s, '[%s]*\"[%s]*' % (ws * 2))
+ splitted = re.split( '[%s]*\"[%s]*' % (ws * 2),s)
split=string.split
if (len(splitted) > 1):