[Zope-Checkins] CVS: Zope/lib/python/Products/ZCatalog - Catalog.py:1.98.6.9.2.1
Casey Duncan
casey@zope.com
Tue, 27 May 2003 00:13:44 -0400
Update of /cvs-repository/Zope/lib/python/Products/ZCatalog
In directory cvs.zope.org:/tmp/cvs-serv24980
Modified Files:
Tag: casey-scored-results-mergable-branch
Catalog.py
Log Message:
Allow scored results (ie from text indexes) to be merged and sorted from multiple catalogs
=== Zope/lib/python/Products/ZCatalog/Catalog.py 1.98.6.9 => 1.98.6.9.2.1 ===
--- Zope/lib/python/Products/ZCatalog/Catalog.py:1.98.6.9 Tue May 27 00:02:09 2003
+++ Zope/lib/python/Products/ZCatalog/Catalog.py Tue May 27 00:13:43 2003
@@ -498,7 +498,14 @@
# scores. Build a new result set, sort it by score, reverse
# it, compute the normalized score, and Lazify it.
- # For now we cannot return raw scores for later merging :^(
+ if not merge:
+ # Don't bother to sort here, return a list of
+ # three tuples to be passed later to mergeResults
+ # note that data_record_normalized_score_ cannot be
+ # calculated and will always be 1 in this case
+ getitem = self.__getitem__
+ return [(score, (1, score, rid), getitem)
+ for rid, score in rs.items()]
rs = rs.byValue(0) # sort it by score
max = float(rs[0][0])