[Checkins] SVN: Zope/trunk/src/Products/ZCatalog/ Extend the query report with information about the resultset length

Hanno Schlichting hannosch at hannosch.eu
Sun Aug 1 14:35:59 EDT 2010


Log message for revision 115347:
  Extend the query report with information about the resultset length
  

Changed:
  U   Zope/trunk/src/Products/ZCatalog/Catalog.py
  U   Zope/trunk/src/Products/ZCatalog/dtml/catalogReport.dtml
  U   Zope/trunk/src/Products/ZCatalog/report.py

-=-
Modified: Zope/trunk/src/Products/ZCatalog/Catalog.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/Catalog.py	2010-08-01 18:35:51 UTC (rev 115346)
+++ Zope/trunk/src/Products/ZCatalog/Catalog.py	2010-08-01 18:35:58 UTC (rev 115347)
@@ -520,7 +520,6 @@
                 r = _apply_index(query, rs)
             else:
                 r = _apply_index(query)
-            cr.split(i)
 
             if r is not None:
                 r, u = r
@@ -529,10 +528,14 @@
                 # once we don't need to support the "return everything" case
                 # anymore
                 if r is not None and not r:
+                    cr.split(i, 0)
                     return LazyCat([])
+                cr.split(i, len(r))
                 w, rs = weightedIntersection(rs, r)
                 if not rs:
                     break
+            else:
+                cr.split(i, 0)
 
         cr.stop()
 

Modified: Zope/trunk/src/Products/ZCatalog/dtml/catalogReport.dtml
===================================================================
--- Zope/trunk/src/Products/ZCatalog/dtml/catalogReport.dtml	2010-08-01 18:35:51 UTC (rev 115346)
+++ Zope/trunk/src/Products/ZCatalog/dtml/catalogReport.dtml	2010-08-01 18:35:58 UTC (rev 115347)
@@ -25,7 +25,7 @@
         </td>
         <td align="left" valign="top">
             <div class="list-nav">
-                Recent duration&nbsp;[ms]
+                Recent
             </div>
         </td>
     </tr>
@@ -53,11 +53,12 @@
                     </td>
                     <td align="left" valign="top">
                         <div class="list-item">
-                            <dtml-var expr="'%3.2f' % last['duration']">
-                            [<dtml-in  expr="last['details']" sort mapping>
-                            &dtml-id;:&nbsp;<dtml-var expr="'%3.2f' % duration">
+                            <dtml-var expr="'%3.2f' % last['duration']">ms
+                            [<dtml-in expr="last['details']" sort mapping>
+                            &dtml-id;:
+                            <dtml-var expr="'%3.2f' % duration">ms /
+                            &dtml-length; objects,
                             </dtml-in>]
-
                         </div>
                     </td>
                 </tr>

Modified: Zope/trunk/src/Products/ZCatalog/report.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/report.py	2010-08-01 18:35:51 UTC (rev 115346)
+++ Zope/trunk/src/Products/ZCatalog/report.py	2010-08-01 18:35:58 UTC (rev 115347)
@@ -48,7 +48,7 @@
     for name, index in indexes.items():
         if IUniqueValueIndex.providedBy(index):
             values = index.uniqueValues()
-            if values and len(values) < MAX_DISTINCT_VALUES:
+            if values and len(list(values)) < MAX_DISTINCT_VALUES:
                 # Only consider indexes which actually return a number
                 # greater than zero
                 new_value_indexes.add(name)
@@ -117,7 +117,7 @@
         self.init()
         self.start_time = time.time()
 
-    def split(self, label):
+    def split(self, label, result_length=None):
         current = time.time()
         start_time, stop_time = self.interim.get(label, (None, None))
 
@@ -126,7 +126,7 @@
             return
 
         self.interim[label] = (start_time, current)
-        self.res.append((label, current - start_time))
+        self.res.append((label, current - start_time, result_length))
 
     def stop(self):
         self.end_time = time.time()
@@ -210,6 +210,7 @@
 
         <duration of single indexes> := [{'id': <index_name1>,
                                           'duration': <duration>,
+                                          'length': <resultset length>,
                                          },
                                          ...
                                         ]
@@ -224,7 +225,8 @@
                 'duration': v[1] * 1000,
                 'last': {'duration': v[2][0] * 1000,
                          'details': [dict(id=i[0],
-                                          duration=i[1]*1000)
+                                          duration=i[1]*1000,
+                                          length=i[2])
                                      for i in v[2][1]],
                         },
                 }



More information about the checkins mailing list