Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
279c466f
Commit
279c466f
authored
Aug 15, 2001
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge bugfix from Zope-2_4-branch
parent
f2d64fb7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
9 deletions
+16
-9
lib/python/Products/PluginIndexes/TextIndex/TextIndex.py
lib/python/Products/PluginIndexes/TextIndex/TextIndex.py
+8
-5
lib/python/Products/PluginIndexes/tests/testTextIndex.py
lib/python/Products/PluginIndexes/tests/testTextIndex.py
+1
-0
lib/python/SearchIndex/UnTextIndex.py
lib/python/SearchIndex/UnTextIndex.py
+6
-4
lib/python/SearchIndex/tests/testUnTextIndex.py
lib/python/SearchIndex/tests/testUnTextIndex.py
+1
-0
No files found.
lib/python/Products/PluginIndexes/TextIndex/TextIndex.py
View file @
279c466f
...
@@ -87,7 +87,7 @@
...
@@ -87,7 +87,7 @@
"""
"""
__version__
=
'$Revision: 1.1
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
4
$'
[
11
:
-
2
]
import
string
,
re
import
string
,
re
...
@@ -202,6 +202,8 @@ class TextIndex(PluggableIndex.PluggableIndex, Persistent,
...
@@ -202,6 +202,8 @@ class TextIndex(PluggableIndex.PluggableIndex, Persistent,
self
.
_lexicon
=
None
self
.
_lexicon
=
None
if
lexicon
is
not
None
:
if
lexicon
is
not
None
:
...
@@ -700,7 +702,6 @@ class TextIndex(PluggableIndex.PluggableIndex, Persistent,
...
@@ -700,7 +702,6 @@ class TextIndex(PluggableIndex.PluggableIndex, Persistent,
else
:
i
=
i
+
1
else
:
i
=
i
+
1
if
(
len
(
query
)
!=
1
):
if
(
len
(
query
)
!=
1
):
import
pdb
;
pdb
.
set_trace
()
raise
QueryError
,
"Malformed query"
raise
QueryError
,
"Malformed query"
return
query
[
0
]
return
query
[
0
]
...
@@ -748,13 +749,14 @@ def parse(s):
...
@@ -748,13 +749,14 @@ def parse(s):
def
parse2
(
q
,
default_operator
,
operator_dict
=
operator_dict
):
def
parse2
(
q
,
default_operator
,
operator_dict
=
operator_dict
):
"""Find operators and operands"""
"""Find operators and operands"""
isop
=
operator_dict
.
has_key
isop
=
operator_dict
.
has_key
i
=
len
(
q
)
-
1
i
=
0
while
i
>=
0
:
while
i
<
len
(
q
)
:
e
=
q
[
i
]
e
=
q
[
i
]
if
isinstance
(
e
,
ListType
):
if
isinstance
(
e
,
ListType
):
q
[
i
]
=
parse2
(
e
,
default_operator
)
q
[
i
]
=
parse2
(
e
,
default_operator
)
if
i
%
2
:
if
i
%
2
:
q
.
insert
(
i
,
default_operator
)
q
.
insert
(
i
,
default_operator
)
i
=
i
+
1
elif
i
%
2
:
elif
i
%
2
:
# This element should be an operator
# This element should be an operator
if
isop
(
e
):
if
isop
(
e
):
...
@@ -763,7 +765,8 @@ def parse2(q, default_operator, operator_dict=operator_dict):
...
@@ -763,7 +765,8 @@ def parse2(q, default_operator, operator_dict=operator_dict):
else
:
else
:
# Insert the default operator.
# Insert the default operator.
q
.
insert
(
i
,
default_operator
)
q
.
insert
(
i
,
default_operator
)
i
=
i
-
1
i
=
i
+
1
i
=
i
+
1
return
q
return
q
...
...
lib/python/Products/PluginIndexes/tests/testTextIndex.py
View file @
279c466f
...
@@ -233,6 +233,7 @@ class Tests(unittest.TestCase):
...
@@ -233,6 +233,7 @@ class Tests(unittest.TestCase):
def
testDefOrQuery
(
self
):
def
testDefOrQuery
(
self
):
"Test a default OR query"
"Test a default OR query"
self
.
globTest
({
'text'
:
'time country'
},
[
0
,
1
,
6
])
self
.
globTest
({
'text'
:
'time country'
},
[
0
,
1
,
6
])
self
.
globTest
({
'text'
:
'time good country'
},
[
0
,
1
,
6
])
def
testNearQuery
(
self
):
def
testNearQuery
(
self
):
"""Test a NEAR query.. (NOTE:ACTUALLY AN 'AND' TEST!!)"""
"""Test a NEAR query.. (NOTE:ACTUALLY AN 'AND' TEST!!)"""
...
...
lib/python/SearchIndex/UnTextIndex.py
View file @
279c466f
...
@@ -91,7 +91,7 @@ undo information so that objects can be unindexed when the old value
...
@@ -91,7 +91,7 @@ undo information so that objects can be unindexed when the old value
is no longer known.
is no longer known.
"""
"""
__version__
=
'$Revision: 1.5
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
1
$'
[
11
:
-
2
]
import
string
,
re
import
string
,
re
...
@@ -684,13 +684,14 @@ def parse2(q, default_operator,
...
@@ -684,13 +684,14 @@ def parse2(q, default_operator,
operator_dict
=
{
AndNot
:
AndNot
,
And
:
And
,
Or
:
Or
,
Near
:
Near
}):
operator_dict
=
{
AndNot
:
AndNot
,
And
:
And
,
Or
:
Or
,
Near
:
Near
}):
"""Find operators and operands"""
"""Find operators and operands"""
isop
=
operator_dict
.
has_key
isop
=
operator_dict
.
has_key
i
=
len
(
q
)
-
1
i
=
0
while
i
>=
0
:
while
i
<
len
(
q
)
:
e
=
q
[
i
]
e
=
q
[
i
]
if
isinstance
(
e
,
ListType
):
if
isinstance
(
e
,
ListType
):
q
[
i
]
=
parse2
(
e
,
default_operator
)
q
[
i
]
=
parse2
(
e
,
default_operator
)
if
i
%
2
:
if
i
%
2
:
q
.
insert
(
i
,
default_operator
)
q
.
insert
(
i
,
default_operator
)
i
=
i
+
1
elif
i
%
2
:
elif
i
%
2
:
# This element should be an operator
# This element should be an operator
if
isop
(
e
):
if
isop
(
e
):
...
@@ -699,7 +700,8 @@ def parse2(q, default_operator,
...
@@ -699,7 +700,8 @@ def parse2(q, default_operator,
else
:
else
:
# Insert the default operator.
# Insert the default operator.
q
.
insert
(
i
,
default_operator
)
q
.
insert
(
i
,
default_operator
)
i
=
i
-
1
i
=
i
+
1
i
=
i
+
1
return
q
return
q
...
...
lib/python/SearchIndex/tests/testUnTextIndex.py
View file @
279c466f
...
@@ -235,6 +235,7 @@ class Tests(unittest.TestCase):
...
@@ -235,6 +235,7 @@ class Tests(unittest.TestCase):
def
testDefOrQuery
(
self
):
def
testDefOrQuery
(
self
):
"Test a default OR query"
"Test a default OR query"
self
.
globTest
({
'text'
:
'time country'
},
[
0
,
1
,
6
])
self
.
globTest
({
'text'
:
'time country'
},
[
0
,
1
,
6
])
self
.
globTest
({
'text'
:
'time good country'
},
[
0
,
1
,
6
])
def
testNearQuery
(
self
):
def
testNearQuery
(
self
):
"""Test a NEAR query.. (NOTE:ACTUALLY AN 'AND' TEST!!)"""
"""Test a NEAR query.. (NOTE:ACTUALLY AN 'AND' TEST!!)"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment