[Zope-Checkins] SVN: Zope/trunk/ Launchpad #348223: optimize catalog query by breaking out early from loop

Tres Seaver tseaver at palladion.com
Tue Mar 24 20:23:05 EDT 2009


Log message for revision 98339:
  Launchpad #348223: optimize catalog query by breaking out early from loop
  over indexes if the result set is already empty.
  
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/Products/ZCatalog/Catalog.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst	2009-03-24 21:07:34 UTC (rev 98338)
+++ Zope/trunk/doc/CHANGES.rst	2009-03-25 00:23:05 UTC (rev 98339)
@@ -35,7 +35,10 @@
 Bugs Fixed
 ++++++++++
 
-- Launchpad#344098: in ``skel/etc/zope.conf.ing``, replaced commented-out
+- Launchpad #348223: optimize catalog query by breaking out early from loop
+  over indexes if the result set is already empty.
+
+- Launchpad #344098: in ``skel/etc/zope.conf.ing``, replaced commented-out
   ``read-only-database`` option, which is deprecated, with pointers to the
   appropos sections of ZODB's ``component.xml``.  Updated the description
   of the ``zserver-read-only-mode`` directive to indicate its correct
@@ -187,7 +190,7 @@
 Bugs Fixed
 ++++++++++
 
-- Launchpad ##332168: Connection.py: do not expose DB connection strings
+- Launchpad #332168: Connection.py: do not expose DB connection strings
   through exceptions
 
 - Specified height/width of icons in ZMI listings so the table doesn't

Modified: Zope/trunk/src/Products/ZCatalog/Catalog.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/Catalog.py	2009-03-24 21:07:34 UTC (rev 98338)
+++ Zope/trunk/src/Products/ZCatalog/Catalog.py	2009-03-25 00:23:05 UTC (rev 98339)
@@ -1,3 +1,4 @@
+
 ##############################################################################
 #
 # Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
@@ -477,7 +478,9 @@
             if r is not None:
                 r, u = r
                 w, rs = weightedIntersection(rs, r)
-        
+                if not rs:
+                   break       
+
         if rs is None:
             # None of the indexes found anything to do with the request
             # We take this to mean that the query was empty (an empty filter)



More information about the Zope-Checkins mailing list