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
b3a75b49
Commit
b3a75b49
authored
Jun 23, 1999
by
Michel Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added __len__ to unindexes
parent
207f2d72
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
11 deletions
+22
-11
lib/python/SearchIndex/UnIndex.py
lib/python/SearchIndex/UnIndex.py
+11
-4
lib/python/SearchIndex/UnTextIndex.py
lib/python/SearchIndex/UnTextIndex.py
+11
-7
No files found.
lib/python/SearchIndex/UnIndex.py
View file @
b3a75b49
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Simple column indices"""
__version__
=
'$Revision: 1.
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
3
$'
[
11
:
-
2
]
from
Globals
import
Persistent
import
BTree
...
...
@@ -147,6 +147,9 @@ class UnIndex(Persistent):
pass
def
__len__
(
self
):
return
len
(
self
.
_unindex
)
def
index_object
(
self
,
i
,
obj
):
""" index and object 'obj' with integer id 'i'"""
index
=
self
.
_index
...
...
@@ -156,9 +159,7 @@ class UnIndex(Persistent):
k
=
getattr
(
obj
,
id
)
if
callable
(
k
):
k
=
str
(
k
())
else
:
k
=
str
(
k
)
k
=
k
()
if
k
is
None
or
k
==
MV
:
return
...
...
@@ -170,6 +171,9 @@ class UnIndex(Persistent):
set
.
insert
(
i
)
unindex
[
i
]
=
k
self
.
_index
=
index
self
.
_unindex
=
unindex
def
unindex_object
(
self
,
i
):
""" Unindex the object with integer id 'i' """
...
...
@@ -182,6 +186,9 @@ class UnIndex(Persistent):
set
=
index
.
get
(
k
)
if
set
is
not
None
:
set
.
remove
(
i
)
self
.
_index
=
index
self
.
_unindex
=
unindex
def
_apply_index
(
self
,
request
,
cid
=
''
):
"""Apply the index to query parameters given in the argument,
...
...
lib/python/SearchIndex/UnTextIndex.py
View file @
b3a75b49
...
...
@@ -202,7 +202,7 @@ Notes on a new text index design
space.
"""
__version__
=
'$Revision: 1.
1
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
2
$'
[
11
:
-
2
]
from
Globals
import
Persistent
import
BTree
,
IIBTree
,
IOBTree
...
...
@@ -245,8 +245,13 @@ class UnTextIndex(Persistent):
else
:
pass
def
__len__
(
self
):
return
len
(
self
.
_unindex
)
def
clear
(
self
):
self
.
_index
=
BTree
()
self
.
_unindex
=
IOBTree
()
def
positions
(
self
,
docid
,
words
):
...
...
@@ -280,7 +285,6 @@ class UnTextIndex(Persistent):
"""Recompute index data for data with ids >= start.
if 'obj' is passed in, it is indexed instead of _data[i]"""
id
=
self
.
id
k
=
getattr
(
obj
,
id
)
...
...
@@ -307,6 +311,8 @@ class UnTextIndex(Persistent):
index
=
self
.
_index
get
=
index
.
get
self
.
_unindex
[
i
]
=
tuple
(
d
.
keys
())
for
word
,
score
in
d
.
items
():
r
=
get
(
word
)
if
r
is
not
None
:
...
...
@@ -325,6 +331,8 @@ class UnTextIndex(Persistent):
else
:
r
[
i
]
=
score
else
:
index
[
word
]
=
i
,
score
self
.
_index
=
index
def
unindex_object
(
self
,
i
,
tt
=
type
(())
):
...
...
@@ -337,7 +345,7 @@ class UnTextIndex(Persistent):
else
:
del
index
[
n
][
i
]
self
.
_index
=
index
def
_subindex
(
self
,
isrc
,
d
,
old
,
last
):
...
...
@@ -392,10 +400,6 @@ class UnTextIndex(Persistent):
id
=
self
.
id
## cidid = "%s/%s" % (cid, id)
## has_key = request.has_key
## if has_key(cidid): keys = request[cidid]
## elif has_key(id): keys =request[id]
if
request
.
has_key
(
id
):
keys
=
request
[
id
]
else
:
return
None
...
...
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