Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
Zope
Commits
27b075f8
Commit
27b075f8
authored
23 years ago
by
Andreas Jung
Browse files
Options
Download
Email Patches
Plain Diff
- added getEntryForObject()
- internal inverse index reworked
parent
1da1319e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
8 deletions
+30
-8
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/Products/PluginIndexes/PathIndex/PathIndex.py
lib/python/Products/PluginIndexes/PathIndex/PathIndex.py
+27
-8
No files found.
doc/CHANGES.txt
View file @
27b075f8
...
...
@@ -54,6 +54,9 @@ Zope Changes
- Added updated and enhanced testsuite for STXNG.
- added getEntryForObject() for PathIndexes. Reworked PathIndex's
internal inverse index.
Bugs fixed
- Collector #2532: ZCatalog.availableSplitters is now protected
...
...
This diff is collapsed.
Click to expand it.
lib/python/Products/PluginIndexes/PathIndex/PathIndex.py
View file @
27b075f8
...
...
@@ -83,7 +83,7 @@
#
##############################################################################
__version__
=
'$Id: PathIndex.py,v 1.
8
2001/10/
03 13:11:02
andreasjung Exp $'
__version__
=
'$Id: PathIndex.py,v 1.
9
2001/10/
12 20:02:15
andreasjung Exp $'
from
Products.PluginIndexes
import
PluggableIndex
from
Products.PluginIndexes.common.util
import
parseIndexRequest
...
...
@@ -100,6 +100,8 @@ from BTrees.IIBTree import IISet,difference,intersection,union
from
types
import
StringType
,
ListType
,
TupleType
import
re
,
warnings
_marker
=
[]
class
PathIndex
(
PluggableIndex
.
PluggableIndex
,
Persistent
,
Implicit
,
SimpleItem
):
...
...
@@ -205,18 +207,23 @@ class PathIndex(PluggableIndex.PluggableIndex, Persistent,
for
i
in
range
(
len
(
comps
)):
self
.
insertEntry
(
comps
[
i
],
documentId
,
i
)
return
1
self
.
_unindex
[
documentId
]
=
path
return
1
def
unindex_object
(
self
,
i
d
):
def
unindex_object
(
self
,
documentI
d
):
""" hook for (Z)Catalog """
if
not
self
.
_unindex
.
has_key
(
i
d
):
return
if
not
self
.
_unindex
.
has_key
(
documentI
d
):
return
for
comp
,
level
in
self
.
_unindex
[
id
]:
path
=
self
.
_unindex
[
documentId
]
comps
=
path
.
split
(
'/'
)
self
.
_index
[
comp
][
level
].
remove
(
id
)
for
level
in
range
(
len
(
comps
[
1
:])
-
1
):
comp
=
comps
[
level
+
1
]
self
.
_index
[
comp
][
level
].
remove
(
documentId
)
if
len
(
self
.
_index
[
comp
][
level
])
==
0
:
del
self
.
_index
[
comp
][
level
]
...
...
@@ -224,7 +231,10 @@ class PathIndex(PluggableIndex.PluggableIndex, Persistent,
if
len
(
self
.
_index
[
comp
])
==
0
:
del
self
.
_index
[
comp
]
del
self
.
_unindex
[
id
]
del
self
.
_unindex
[
documentId
]
def
printIndex
(
self
):
...
...
@@ -395,6 +405,15 @@ class PathIndex(PluggableIndex.PluggableIndex, Persistent,
""" needed to be consistent with the interface """
return
self
.
_index
.
keys
()
def
getEntryForObject
(
self
,
documentId
,
default
=
_marker
):
""" Takes a document ID and returns all the information we have
on that specific object. """
try
:
return
self
.
_unindex
[
documentId
]
except
:
return
None
index_html
=
DTMLFile
(
'dtml/index'
,
globals
())
...
...
This diff is collapsed.
Click to expand it.
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