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

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


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

Modified Files:
	Catalog.py 
Log Message:
merge changes from scored results mergable branch.


=== Zope/lib/python/Products/ZCatalog/Catalog.py 1.110 => 1.111 ===
--- Zope/lib/python/Products/ZCatalog/Catalog.py:1.110	Tue May 27 00:40:30 2003
+++ Zope/lib/python/Products/ZCatalog/Catalog.py	Tue May 27 00:47:43 2003
@@ -493,8 +493,15 @@
                 # having a 'values' means we have a data structure with
                 # 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])