[Zope-Checkins] CVS: Packages/SearchIndex - TextIndex.py:1.29.16.1 UnTextIndex.py:1.49.4.2
Evan Simpson
evan@zope.com
Wed, 15 Aug 2001 16:39:20 -0400
Update of /cvs-repository/Packages/SearchIndex
In directory cvs.zope.org:/tmp/cvs-serv12571
Modified Files:
Tag: Zope-2_4-branch
TextIndex.py UnTextIndex.py
Log Message:
Fix parse2 bug, add unit test for it.
=== Packages/SearchIndex/TextIndex.py 1.29 => 1.29.16.1 ===
def evaluate(q, index, ListType=type([])):
'''Evaluate a parsed query'''
-## import pdb
-## pdb.set_trace()
if (len(q) == 1):
if (type(q[0]) is ListType):
=== Packages/SearchIndex/UnTextIndex.py 1.49.4.1 => 1.49.4.2 ===
"""Find operators and operands"""
isop = operator_dict.has_key
- i = len(q) - 1
- while i >= 0:
+ i = 0
+ while i < len(q):
e = q[i]
if isinstance(e, ListType):
q[i] = parse2(e, default_operator)
if i % 2:
q.insert(i, default_operator)
+ i = i + 1
elif i % 2:
# This element should be an operator
if isop(e):
@@ -699,7 +700,8 @@
else:
# Insert the default operator.
q.insert(i, default_operator)
- i = i - 1
+ i = i + 1
+ i = i + 1
return q