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
88a74389
Commit
88a74389
authored
Apr 17, 2002
by
Toby Dickenson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merged toby-catalog-cmp-collision-branch
parent
cbf53715
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
lib/python/Products/ZCatalog/Catalog.py
lib/python/Products/ZCatalog/Catalog.py
+22
-3
No files found.
lib/python/Products/ZCatalog/Catalog.py
View file @
88a74389
...
...
@@ -29,7 +29,7 @@ from BTrees.IOBTree import IOBTree
import
BTrees.Length
from
Products.PluginIndexes.common.randid
import
randid
import
time
import
time
,
sys
class
Catalog
(
Persistent
,
Acquisition
.
Implicit
,
ExtensionClass
.
Base
):
""" An Object Catalog
...
...
@@ -509,6 +509,13 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
return
used
def
_build_sorted_results
(
self
,
rs
,
sort_index
,
append
):
# This function will .append pairs where the first item
# in the pair is a sort key, and the second item in the
# pair is a squence of results which share the same
# sort key. Later on the list to which these things
# are .append()ed will be .sort()ed, and the first element
# of each pair stripped.
#
# The two 'for' loops in here contribute a significant
# proportion of the time to perform an indexed search.
# Try to avoid all non-local attribute lookup inside
...
...
@@ -534,16 +541,28 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
# Is this ever true?
intset
=
keys
()
append
((
k
,
_lazymap
(
_self__getitem__
,
intset
)))
# Note that sort keys are unique.
else
:
if
hasattr
(
rs
,
'keys'
):
rs
=
rs
.
keys
()
_sort_index_keyForDocument
=
sort_index
.
keyForDocument
_keyerror
=
KeyError
for
did
in
rs
:
try
:
append
((
_sort_index_keyForDocument
(
did
),
_lazymap
(
_self__getitem__
,[
did
])))
key
=
_sort_index_keyForDocument
(
did
)
except
_keyerror
:
# This document is not in the sort key index.
# skip it.
pass
else
:
# We want the sort keys to be unique so that
# .sort()ing the list does not involve comparing
# _lazymap objects, which is slow. To ensure
# uniqueness the first element of each pair is
# actually a tuple of:
# (real sort key, some unique number)
lm
=
_lazymap
(
_self__getitem__
,[
did
])
key
=
(
key
,
id
(
lm
))
append
((
key
,
lm
))
def
searchResults
(
self
,
REQUEST
=
None
,
used
=
None
,
**
kw
):
...
...
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