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
e8e3d9ef
Commit
e8e3d9ef
authored
Oct 10, 1997
by
Jeffrey Shell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added range searching/indexing
parent
91f231a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
8 deletions
+36
-8
lib/python/SearchIndex/Index.py
lib/python/SearchIndex/Index.py
+36
-8
No files found.
lib/python/SearchIndex/Index.py
View file @
e8e3d9ef
...
@@ -10,13 +10,14 @@
...
@@ -10,13 +10,14 @@
__doc__
=
'''Simple column indexes
__doc__
=
'''Simple column indexes
$Id: Index.py,v 1.
9 1997/09/26 22:21:43 jim
Exp $'''
$Id: Index.py,v 1.
10 1997/10/10 18:34:56 jeffrey
Exp $'''
__version__
=
'$Revision: 1.
9
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
10
$'
[
11
:
-
2
]
from
BTree
import
BTree
from
BTree
import
BTree
from
intSet
import
intSet
from
intSet
import
intSet
import
operator
import
operator
from
Missing
import
MV
from
Missing
import
MV
import
string
ListType
=
type
([])
ListType
=
type
([])
...
@@ -127,7 +128,7 @@ class Index:
...
@@ -127,7 +128,7 @@ class Index:
all data fields used.
all data fields used.
"""
"""
id
=
self
.
id
id
=
self
.
id
#name of the column
try
:
keys
=
request
[
"%s/%s"
%
(
cid
,
id
)]
try
:
keys
=
request
[
"%s/%s"
%
(
cid
,
id
)]
except
:
except
:
...
@@ -138,13 +139,37 @@ class Index:
...
@@ -138,13 +139,37 @@ class Index:
index
=
self
.
_index
index
=
self
.
_index
r
=
None
r
=
None
anyTrue
=
0
anyTrue
=
0
for
key
in
keys
:
opr
=
None
if
key
:
anyTrue
=
1
if
request
.
has_key
(
id
+
'_usage'
):
# see if any usage params are sent to field
opr
=
string
.
split
(
string
.
lower
(
request
[
id
+
"_usage"
]),
':'
)
try
:
opr
,
opr_args
=
opr
[
0
],
opr
[
1
:]
except
IndexError
:
opr
,
opr_args
=
opr
[
0
],
[]
if
opr
==
"range"
:
if
'min'
in
opr_args
:
lo
=
min
(
keys
)
else
:
lo
=
None
if
'max'
in
opr_args
:
hi
=
max
(
keys
)
else
:
hi
=
None
anyTrue
=
1
try
:
try
:
set
=
index
[
key
]
setlist
=
index
.
items
(
lo
,
hi
)
if
r
is
None
:
r
=
set
for
k
,
set
in
setlist
:
else
:
r
=
r
.
union
(
set
)
if
r
is
None
:
r
=
set
else
:
r
=
r
.
union
(
set
)
except
KeyError
:
pass
except
KeyError
:
pass
else
:
#not a range
for
key
in
keys
:
if
key
:
anyTrue
=
1
try
:
set
=
index
[
key
]
if
r
is
None
:
r
=
set
else
:
r
=
r
.
union
(
set
)
except
KeyError
:
pass
if
r
is
None
:
if
r
is
None
:
if
anyTrue
:
r
=
intSet
()
if
anyTrue
:
r
=
intSet
()
...
@@ -156,6 +181,9 @@ class Index:
...
@@ -156,6 +181,9 @@ class Index:
##############################################################################
##############################################################################
#
#
# $Log: Index.py,v $
# $Log: Index.py,v $
# Revision 1.10 1997/10/10 18:34:56 jeffrey
# Added range searching/indexing
#
# Revision 1.9 1997/09/26 22:21:43 jim
# Revision 1.9 1997/09/26 22:21:43 jim
# added protocol needed by searchable objects
# added protocol needed by searchable objects
#
#
...
...
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