[Checkins] SVN: z3c.indexer/trunk/ Docstring/README typos.

Dan Korostelev nadako at gmail.com
Sat Jan 3 11:45:16 EST 2009


Log message for revision 94493:
  Docstring/README typos.
  Fix bug with index names passed as unicode.
  Add ZCML file with intid event subscribers for easy re-use in applications.

Changed:
  U   z3c.indexer/trunk/CHANGES.txt
  U   z3c.indexer/trunk/README.txt
  U   z3c.indexer/trunk/setup.py
  U   z3c.indexer/trunk/src/z3c/indexer/README.txt
  U   z3c.indexer/trunk/src/z3c/indexer/index.py
  U   z3c.indexer/trunk/src/z3c/indexer/interfaces.py
  U   z3c.indexer/trunk/src/z3c/indexer/query.py
  A   z3c.indexer/trunk/src/z3c/indexer/subscriber.zcml

-=-
Modified: z3c.indexer/trunk/CHANGES.txt
===================================================================
--- z3c.indexer/trunk/CHANGES.txt	2009-01-03 16:29:08 UTC (rev 94492)
+++ z3c.indexer/trunk/CHANGES.txt	2009-01-03 16:45:15 UTC (rev 94493)
@@ -5,10 +5,21 @@
 0.6.0 (unreleased)
 ------------------
 
-- Feature: added support for sorting by indexed values,
-  introduced in zope.index 3.5.0.
+- Feature: Add support for sorting by indexed values, introduced in
+  zope.index 3.5.0. See description of the ``searchResults`` method
+  of ISearchQuery.
 
+- Bugfix: Make query object constructor work with index name
+  passed as unicode as well as with str.
 
+- Mention ``searchResultFactory`` argument in the ``searchResults`` method
+  of the ISearchQuery interface.
+
+- Added the "subscriber.zcml" file that contains ZCML-based intid subscriber
+  registrations for easy including in projects that use event-based indexing.
+
+- Reworded package description to make it nicer. Fix little docstring typos.
+
 0.5.1 (2008-12-11)
 ------------------
 

Modified: z3c.indexer/trunk/README.txt
===================================================================
--- z3c.indexer/trunk/README.txt	2009-01-03 16:29:08 UTC (rev 94492)
+++ z3c.indexer/trunk/README.txt	2009-01-03 16:45:15 UTC (rev 94493)
@@ -1,2 +1,2 @@
-This package provides an implementation for indexing objects and query indexes 
-for Zope3. This will make zope.app.catalog obsolate.
+This package provides a way to index objects and query indexes for Zope3. This
+implementation is different from zope.app.catalog and is an alternative to it.

Modified: z3c.indexer/trunk/setup.py
===================================================================
--- z3c.indexer/trunk/setup.py	2009-01-03 16:29:08 UTC (rev 94492)
+++ z3c.indexer/trunk/setup.py	2009-01-03 16:45:15 UTC (rev 94493)
@@ -44,7 +44,7 @@
         'Operating System :: OS Independent',
         'Topic :: Internet :: WWW/HTTP',
         'Framework :: Zope3'],
-    url = 'http://cheeseshop.python.org/pypi/z3c.indexer',
+    url = 'http://pypi.python.org/pypi/z3c.indexer',
     packages = find_packages('src'),
     include_package_data = True,
     package_dir = {'':'src'},

Modified: z3c.indexer/trunk/src/z3c/indexer/README.txt
===================================================================
--- z3c.indexer/trunk/src/z3c/indexer/README.txt	2009-01-03 16:29:08 UTC (rev 94492)
+++ z3c.indexer/trunk/src/z3c/indexer/README.txt	2009-01-03 16:45:15 UTC (rev 94493)
@@ -185,12 +185,9 @@
 - The default IIndexer adapter will lookup a IIndexValue multi adapter for each
   (object, index) tuple and get the right value from this adapter. You can
   register custom IIndexer adapters for your objects if you like to avoid this
-  additional adapter call.
+  additional adapter call. (XXX: This is not actually true, is this pattern
+  deprecated?)
 
-- Each obj, index pair can have a IIndexValue multi adapter which knows how
-  to get the value which get indexed. Only needed if no IIndexer adapter is
-  available for your custom object.
-
 - Everything is explicit. This means that there's no default actions on
   the IntIdAddedEvent by. But you can easily write your own subscriber if
   you need to use it. This package provides ready-to-use event handlers

Modified: z3c.indexer/trunk/src/z3c/indexer/index.py
===================================================================
--- z3c.indexer/trunk/src/z3c/indexer/index.py	2009-01-03 16:29:08 UTC (rev 94492)
+++ z3c.indexer/trunk/src/z3c/indexer/index.py	2009-01-03 16:45:15 UTC (rev 94493)
@@ -29,13 +29,14 @@
 
 
 class IndexMixin(object):
-    """Text index based on zope.index.text.textindex.TextIndex"""
+    """Index mixin class for indexes implementing zope.index.interfaces.IInjection"""
 
     def doIndex(self, oid, value):
-        """Index a value by it's id."""
+        """Index a value by its object id."""
         self.index_doc(oid, value)
 
     def doUnIndex(self, oid):
+        """Unindex a value by its object id."""
         self.unindex_doc(oid)
 
 
@@ -47,7 +48,7 @@
 
 class FieldIndex(IndexMixin, fieldindex.FieldIndex,
     contained.Contained):
-    """Text index based on zope.index.text.textindex.TextIndex
+    """Field index based on zope.index.field.index.TextIndex
     
     Field index will use tuple in it's base apply method.
     """

Modified: z3c.indexer/trunk/src/z3c/indexer/interfaces.py
===================================================================
--- z3c.indexer/trunk/src/z3c/indexer/interfaces.py	2009-01-03 16:29:08 UTC (rev 94492)
+++ z3c.indexer/trunk/src/z3c/indexer/interfaces.py	2009-01-03 16:45:15 UTC (rev 94493)
@@ -49,9 +49,23 @@
     def apply():
         """Return iterable search result wrapper."""
 
-    def searchResults(intids=None, sort_index=None, reverse=False, limit=None):
-        """Retruns an iterable search result objects. Optional the intids 
-        utility can be set for use within the ResulSet implementation.
+    def searchResults(intids=None, searchResultFactory=None, sort_index=None, reverse=False, limit=None):
+        """Returns an iterable search result objects.
+
+        The IntIds utility can be specified for use in the ResulSet using the ``intids`` argument.
+        
+        The ``searchResultFactory`` argument can be used to specify a factory
+        for the ResultSet object, returned by this method.
+        
+        The name of index to sort results with can be specified using the
+        ``sort_index`` argument. The index should provide the
+        zope.index.interfaces.IIndexSort interface. The optional ``reverse``
+        and ``limit`` argument will be used by the index for efficient sorting.
+        
+        Though the ``limit`` and ``reverse`` arguments can be used without the
+        ``sort_index``, it doesn't make much sense, because we can't guarantee
+        any particular order in unsorted result set.
+
         """
 
     def Or(query):

Modified: z3c.indexer/trunk/src/z3c/indexer/query.py
===================================================================
--- z3c.indexer/trunk/src/z3c/indexer/query.py	2009-01-03 16:29:08 UTC (rev 94492)
+++ z3c.indexer/trunk/src/z3c/indexer/query.py	2009-01-03 16:45:15 UTC (rev 94493)
@@ -24,7 +24,7 @@
     """Index query."""
 
     def __init__(self, indexOrName):
-        if isinstance(indexOrName, str):
+        if isinstance(indexOrName, basestring):
             self.index = zope.component.getUtility(interfaces.IIndex,
                 name=indexOrName)
         else:

Added: z3c.indexer/trunk/src/z3c/indexer/subscriber.zcml
===================================================================
--- z3c.indexer/trunk/src/z3c/indexer/subscriber.zcml	                        (rev 0)
+++ z3c.indexer/trunk/src/z3c/indexer/subscriber.zcml	2009-01-03 16:45:15 UTC (rev 94493)
@@ -0,0 +1,7 @@
+<configure xmlns="http://namespaces.zope.org/zope">
+
+	<subscriber handler=".subscriber.intIdAddedEventDispatcher" />
+	<subscriber handler=".subscriber.objectModifiedDispatcher" />
+	<subscriber handler=".subscriber.intIdRemovedEventDispatcher" />
+
+</configure>



More information about the Checkins mailing list