[Zope-Checkins] CVS: Zope/lib/python/Products/ZCatalog - Catalog.py:1.98.6.10

Casey Duncan casey@zope.com
Tue, 27 May 2003 00:26:29 -0400


Update of /cvs-repository/Zope/lib/python/Products/ZCatalog
In directory cvs.zope.org:/tmp/cvs-serv26841/lib/python/Products/ZCatalog

Modified Files:
      Tag: Zope-2_6-branch
	Catalog.py 
Log Message:
merge scored results mergable branch. Allows scored results in catalog
to be merged like unscored results can.


=== Zope/lib/python/Products/ZCatalog/Catalog.py 1.98.6.9 => 1.98.6.10 ===
--- 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:26:29 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])