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
f1f2ebcc
Commit
f1f2ebcc
authored
Jul 15, 1999
by
Michel Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed range searching on UnIndexes. (this is tough stuff!)
parent
ac181a2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
18 deletions
+39
-18
lib/python/SearchIndex/UnIndex.py
lib/python/SearchIndex/UnIndex.py
+39
-18
No files found.
lib/python/SearchIndex/UnIndex.py
View file @
f1f2ebcc
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
##############################################################################
##############################################################################
"""Simple column indices"""
"""Simple column indices"""
__version__
=
'$Revision: 1.
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
from
Globals
import
Persistent
from
Globals
import
Persistent
import
BTree
import
BTree
...
@@ -152,6 +152,7 @@ class UnIndex(Persistent):
...
@@ -152,6 +152,7 @@ class UnIndex(Persistent):
def
index_object
(
self
,
i
,
obj
,
threshold
=
None
):
def
index_object
(
self
,
i
,
obj
,
threshold
=
None
):
""" index and object 'obj' with integer id 'i'"""
""" index and object 'obj' with integer id 'i'"""
index
=
self
.
_index
index
=
self
.
_index
unindex
=
self
.
_unindex
unindex
=
self
.
_unindex
...
@@ -161,19 +162,22 @@ class UnIndex(Persistent):
...
@@ -161,19 +162,22 @@ class UnIndex(Persistent):
k
=
getattr
(
obj
,
id
)
k
=
getattr
(
obj
,
id
)
if
callable
(
k
):
if
callable
(
k
):
k
=
k
()
k
=
k
()
print
'found %s'
%
k
except
:
except
:
k
=
MV
k
=
MV
print
'couldnt get %s of %s'
%
(
id
,
obj
)
if
k
is
None
or
k
==
MV
:
##
if k is None or k == MV:
return
0
##
return 0
set
=
index
.
get
(
k
)
set
=
index
.
get
(
k
)
if
set
is
None
:
if
set
is
None
:
index
[
k
]
=
set
=
intSet
()
index
[
k
]
=
set
=
intSet
()
set
.
insert
(
i
)
set
.
insert
(
i
)
unindex
[
i
]
=
k
unindex
[
i
]
=
k
self
.
_index
=
index
self
.
_index
=
index
self
.
_unindex
=
unindex
self
.
_unindex
=
unindex
...
@@ -232,7 +236,7 @@ class UnIndex(Persistent):
...
@@ -232,7 +236,7 @@ class UnIndex(Persistent):
if
request
.
has_key
(
id
+
'_usage'
):
if
request
.
has_key
(
id
+
'_usage'
):
# see if any usage params are sent to field
# see if any usage params are sent to field
opr
=
string
.
split
(
string
.
lower
(
request
[
id
+
"_usage"
]),
':'
)
opr
=
string
.
split
(
string
.
lower
(
request
[
id
+
"_usage"
]),
':'
)
pdb
.
set_trace
()
#
pdb.set_trace()
opr
,
opr_args
=
opr
[
0
],
opr
[
1
:]
opr
,
opr_args
=
opr
[
0
],
opr
[
1
:]
if
opr
==
"range"
:
if
opr
==
"range"
:
...
@@ -243,25 +247,42 @@ class UnIndex(Persistent):
...
@@ -243,25 +247,42 @@ class UnIndex(Persistent):
anyTrue
=
1
anyTrue
=
1
try
:
try
:
if
hi
:
setlist
=
index
.
items
(
lo
,
hi
)
if
hi
:
else
:
setlist
=
index
.
items
(
lo
)
setlist
=
index
.
items
(
lo
,
hi
)
for
k
,
set
in
setlist
:
else
:
if
r
is
None
:
r
=
set
setlist
=
index
.
items
(
lo
)
else
:
r
=
r
.
union
(
set
)
except
KeyError
:
pass
for
k
,
set
in
setlist
:
print
'adding set %s to %s'
%
(
tuple
(
set
),
id
)
if
r
is
None
:
r
=
set
else
:
r
=
r
.
union
(
set
)
except
KeyError
:
pass
else
:
#not a range
else
:
#not a range
get
=
index
.
get
get
=
index
.
get
for
key
in
keys
:
for
key
in
keys
:
if
key
:
anyTrue
=
1
if
key
:
anyTrue
=
1
set
=
get
(
key
)
set
=
get
(
key
)
if
set
is
not
None
:
if
set
is
not
None
:
if
r
is
None
:
r
=
set
if
r
is
None
:
else
:
r
=
r
.
union
(
set
)
r
=
set
else
:
r
=
r
.
union
(
set
)
if
r
is
None
:
if
r
is
None
:
if
anyTrue
:
r
=
intSet
()
if
anyTrue
:
else
:
return
None
r
=
intSet
()
else
:
return
None
# pdb.set_trace()
# print 'r is %s' % tuple(r)
print
'UnIndex says there are %s records'
%
len
(
r
)
return
r
,
(
id
,)
return
r
,
(
id
,)
...
...
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