[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/index -
__init__.py:1.3 text.py:1.5
Anthony Baxter
anthony at interlink.com.au
Tue Aug 5 05:33:42 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/interfaces/index
In directory cvs.zope.org:/tmp/cvs-serv24050/app/interfaces/index
Modified Files:
__init__.py text.py
Log Message:
Refactoring of the Catalog<->Index interface to extract common code.
TextIndexes now index a particular interface+field combination, which
defaults to ISearchableText/getSearchText. Making a new index hook into
the catalog is now a matter of two or three lines of python and some
zcml.
=== Zope3/src/zope/app/interfaces/index/__init__.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/interfaces/index/__init__.py:1.2 Wed Dec 25 09:12:59 2002
+++ Zope3/src/zope/app/interfaces/index/__init__.py Tue Aug 5 04:33:34 2003
@@ -1,2 +1,10 @@
#
# This file is necessary to make this directory a package.
+
+from zope.interface import Interface
+
+class IInterfaceIndexer(Interface):
+ """I index objects by first adapting them to an interface, then
+ retrieving a field on the adapted object.
+ """
+
=== Zope3/src/zope/app/interfaces/index/text.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/interfaces/index/text.py:1.4 Mon Jul 14 04:31:22 2003
+++ Zope3/src/zope/app/interfaces/index/text.py Tue Aug 5 04:33:34 2003
@@ -17,6 +17,10 @@
"""
from zope.interface import Interface
+from zope.schema import BytesLine
+from zope.app.component.interfacefield import InterfaceField
+
+from zope.index.interfaces import IStatistics
class ISearchableText(Interface):
@@ -32,13 +36,21 @@
returning None indicates the object should not be indexed
"""
-from zope.index.interfaces import IStatistics
-
class IUITextCatalogIndex(IStatistics):
"""Interface for creating a TextIndex from with a catalog"""
+ interface = InterfaceField(
+ title=u"Interface",
+ description=u"Objects will be adapted to this interface",
+ required=False,
+ default=ISearchableText)
+
+ field_name = BytesLine(
+ title=u"Field Name",
+ description=u"Name of the field to index",
+ default="getSearchableText")
-class IUITextIndex(IStatistics):
+class IUITextIndex(IUITextCatalogIndex):
"""Interface for creating a TextIndex from the ZMI."""
More information about the Zope3-Checkins
mailing list