[Zope-Checkins] CVS: Zope/lib/python/Products/ZCatalog -
Catalog.py:1.111.2.6
Casey Duncan
casey at zope.com
Tue May 18 10:49:19 EDT 2004
Update of /cvs-repository/Zope/lib/python/Products/ZCatalog
In directory cvs.zope.org:/tmp/cvs-serv25626/lib/python/Products/ZCatalog
Modified Files:
Tag: Zope-2_7-branch
Catalog.py
Log Message:
Fix KeyError in mergeResults() when merging results sorted using a small index.
Add mergeResults unit tests.
=== Zope/lib/python/Products/ZCatalog/Catalog.py 1.111.2.5 => 1.111.2.6 ===
--- Zope/lib/python/Products/ZCatalog/Catalog.py:1.111.2.5 Mon Apr 26 11:42:32 2004
+++ Zope/lib/python/Products/ZCatalog/Catalog.py Tue May 18 10:48:48 2004
@@ -583,7 +583,8 @@
rs = rs.keys()
rlen = len(rs)
- if limit is None and (rlen > (len(sort_index) * (rlen / 100 + 1))):
+ if merge and limit is None and (
+ rlen > (len(sort_index) * (rlen / 100 + 1))):
# The result set is much larger than the sorted index,
# so iterate over the sorted index for speed.
# This is rarely exercised in practice...
@@ -611,13 +612,10 @@
append((k, intset, _self__getitem__))
# Note that sort keys are unique.
- if merge:
- result.sort()
- if reverse:
- result.reverse()
- result = LazyCat(LazyValues(result), length)
- else:
- return result
+ result.sort()
+ if reverse:
+ result.reverse()
+ result = LazyCat(LazyValues(result), length)
elif limit is None or (limit * 4 > rlen):
# Iterate over the result set getting sort keys from the index
for did in rs:
More information about the Zope-Checkins
mailing list