[Checkins] SVN: zope.app.catalog/branches/nadako-sorting/ Fix default values for TextIndex addform (and fix field_name to correct one for that).

Dan Korostelev nadako at gmail.com
Sun Dec 28 03:25:48 EST 2008


Log message for revision 94407:
  Fix default values for TextIndex addform (and fix field_name to correct one for that).
  Add Keyword catalog indexes, because KeywordIndex in zope.index can do ``apply`` now.
  

Changed:
  U   zope.app.catalog/branches/nadako-sorting/CHANGES.txt
  U   zope.app.catalog/branches/nadako-sorting/setup.py
  U   zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/browser/configure.zcml
  U   zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/classes.zcml
  A   zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/keyword.py
  U   zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/text.py

-=-
Modified: zope.app.catalog/branches/nadako-sorting/CHANGES.txt
===================================================================
--- zope.app.catalog/branches/nadako-sorting/CHANGES.txt	2008-12-28 07:24:12 UTC (rev 94406)
+++ zope.app.catalog/branches/nadako-sorting/CHANGES.txt	2008-12-28 08:25:47 UTC (rev 94407)
@@ -5,8 +5,18 @@
 3.6.0 (unreleased)
 ------------------
 
+- Make TextIndex addform use default values as specified in
+  zope.app.catalog.text.ITextIndex interface. Also, change
+  "searchableText" to "getSearchableText" there, as it's the
+  right value.
+
+- Add Keyword (case-insensitive and case-sensitive) catalog
+  indexex. It's now possible to use them, because ones in
+  zope.index now implement IIndexSearch interface.
+
 - Add support for sorting, reversing and limiting result set,
   using new zope.index IIndexSort features.
+
 - Remove testing dependencies from install_requires.
 
 3.5.1 (2007-10-31)

Modified: zope.app.catalog/branches/nadako-sorting/setup.py
===================================================================
--- zope.app.catalog/branches/nadako-sorting/setup.py	2008-12-28 07:24:12 UTC (rev 94406)
+++ zope.app.catalog/branches/nadako-sorting/setup.py	2008-12-28 08:25:47 UTC (rev 94407)
@@ -22,7 +22,7 @@
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
 
 setup(name = 'zope.app.catalog',
-      version = '3.5.2dev',
+      version = '3.6.0dev',
       author='Zope Corporation and Contributors',
       author_email='zope3-dev at zope.org',
       description='Zope Cataloging and Indexing Framework',

Modified: zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/browser/configure.zcml
===================================================================
--- zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/browser/configure.zcml	2008-12-28 07:24:12 UTC (rev 94406)
+++ zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/browser/configure.zcml	2008-12-28 08:25:47 UTC (rev 94407)
@@ -65,9 +65,55 @@
     />
 
 <addform
+    name="AddKeywordIndex"
+    label="Add a keyword index"
+    schema="..interfaces.IAttributeIndex"
+    permission="zope.ManageServices"
+    content_factory="..keyword.KeywordIndex"
+    arguments="field_name"
+    keyword_arguments="interface field_callable"
+    />
+
+<addMenuItem
+    title="Keyword Index"
+    description="Index items based on sequence of keywords"
+    class="..keyword.KeywordIndex"
+    permission="zope.ManageServices"
+    view="AddKeywordIndex"
+   />
+
+<addform
+    name="AddCaseSensitiveKeywordIndex"
+    label="Add a keyword index (case-sensitive)"
+    schema="..interfaces.IAttributeIndex"
+    permission="zope.ManageServices"
+    content_factory="..keyword.CaseSensitiveKeywordIndex"
+    arguments="field_name"
+    keyword_arguments="interface field_callable"
+    />
+
+<addMenuItem
+    title="Keyword Index (case-sensitive)"
+    description="Index items based on sequence of keywords"
+    class="..keyword.CaseSensitiveKeywordIndex"
+    permission="zope.ManageServices"
+    view="AddCaseSensitiveKeywordIndex"
+   />
+
+<schemadisplay
+    name="index.html"
+    schema="..keyword.IKeywordIndex"
+    label="Keyword Index"
+    fields="interface field_name field_callable"
+    permission="zope.ManageServices"
+    menu="zmi_views" title="Configuration"
+    />
+
+<addform
     name="AddTextIndex"
     label="Add a text index"
-    schema="..interfaces.IAttributeIndex"
+    schema="..text.ITextIndex"
+    fields="interface field_name field_callable"
     permission="zope.ManageServices"
     content_factory="..text.TextIndex"
     arguments="field_name"

Modified: zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/classes.zcml
===================================================================
--- zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/classes.zcml	2008-12-28 07:24:12 UTC (rev 94406)
+++ zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/classes.zcml	2008-12-28 08:25:47 UTC (rev 94407)
@@ -42,6 +42,19 @@
         />
   </class>
 
+  <class class=".keyword.KeywordIndex">
+    <require
+        permission="zope.ManageServices"
+        interface=".interfaces.IAttributeIndex
+                   zope.index.interfaces.IStatistics"
+        set_schema=".interfaces.IAttributeIndex"
+        />
+  </class>
+
+  <class class=".keyword.CaseSensitiveKeywordIndex">
+    <require like_class=".keyword.KeywordIndex" /> 
+  </class>
+
   <class class=".text.TextIndex">
     <require
         permission="zope.ManageServices"

Added: zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/keyword.py
===================================================================
--- zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/keyword.py	                        (rev 0)
+++ zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/keyword.py	2008-12-28 08:25:47 UTC (rev 94407)
@@ -0,0 +1,39 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Keyword catalog index
+
+$Id:$
+"""
+import zope.index.keyword
+import zope.interface
+
+import zope.app.container.contained
+import zope.app.catalog.attribute
+import zope.app.catalog.interfaces
+
+class IKeywordIndex(zope.app.catalog.interfaces.IAttributeIndex,
+                    zope.app.catalog.interfaces.ICatalogIndex):
+    """Interface-based catalog keyword index"""
+
+class KeywordIndex(zope.app.catalog.attribute.AttributeIndex,
+                   zope.index.keyword.KeywordIndex,
+                   zope.app.container.contained.Contained):
+
+    zope.interface.implements(IKeywordIndex)
+
+class CaseSensitiveKeywordIndex(zope.app.catalog.attribute.AttributeIndex,
+                                zope.index.keyword.CaseSensitiveKeywordIndex,
+                                zope.app.container.contained.Contained):
+
+    zope.interface.implements(IKeywordIndex)

Modified: zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/text.py
===================================================================
--- zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/text.py	2008-12-28 07:24:12 UTC (rev 94406)
+++ zope.app.catalog/branches/nadako-sorting/src/zope/app/catalog/text.py	2008-12-28 08:25:47 UTC (rev 94407)
@@ -40,7 +40,7 @@
     field_name = zope.schema.BytesLine(
         title=_(u"Field Name"),
         description=_(u"Name of the field to index"),
-        default="searchableText"
+        default="getSearchableText"
         )
 
     field_callable = zope.schema.Bool(



More information about the Checkins mailing list