[Checkins] SVN: Products.ZCatalog/trunk/src/Products/PluginIndexes/UUIDIndex/UUIDIndex.py Optimize `uniqueValues` on UUIDIndex

Hanno Schlichting hannosch at hannosch.eu
Fri Jan 28 14:26:50 EST 2011


Log message for revision 119992:
  Optimize `uniqueValues` on UUIDIndex
  

Changed:
  U   Products.ZCatalog/trunk/src/Products/PluginIndexes/UUIDIndex/UUIDIndex.py

-=-
Modified: Products.ZCatalog/trunk/src/Products/PluginIndexes/UUIDIndex/UUIDIndex.py
===================================================================
--- Products.ZCatalog/trunk/src/Products/PluginIndexes/UUIDIndex/UUIDIndex.py	2011-01-28 19:23:01 UTC (rev 119991)
+++ Products.ZCatalog/trunk/src/Products/PluginIndexes/UUIDIndex/UUIDIndex.py	2011-01-28 19:26:49 UTC (rev 119992)
@@ -56,6 +56,22 @@
         """
         return self.indexSize()
 
+    def uniqueValues(self, name=None, withLengths=0):
+        """returns the unique values for name
+
+        if withLengths is true, returns a sequence of
+        tuples of (value, length)
+        """
+        if name is None:
+            name = self.id
+        elif name != self.id:
+            return []
+
+        if not withLengths:
+            return tuple(self._index.keys())
+        # We know the length for each value is one
+        return [(k, 1) for k in self._index.keys()]
+
     def insertForwardIndexEntry(self, entry, documentId):
         """Take the entry provided and put it in the correct place
         in the forward index.



More information about the checkins mailing list