[Zope3-checkins] CVS: Zope3/src/zope/app/index - adapters.py:1.4 configure.zcml:1.7

Anthony Baxter anthony at interlink.com.au
Sun Aug 3 02:41:42 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/index
In directory cvs.zope.org:/tmp/cvs-serv24358/src/zope/app/index

Modified Files:
	adapters.py configure.zcml 
Log Message:
hooking up keyword indexes to the catalog (even got tests!)


=== Zope3/src/zope/app/index/adapters.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/index/adapters.py:1.3	Sat Aug  2 13:22:01 2003
+++ Zope3/src/zope/app/index/adapters.py	Sun Aug  3 01:41:07 2003
@@ -1,7 +1,6 @@
-from zope.index.interfaces import IQuerying, ISimpleQuery
+from zope.index.interfaces import IQuerying, ISimpleQuery, IKeywordQuerying
 from zodb.btrees.IIBTree import IISet
 
-
 class SimpleQuery:
     "Call an IQuerying search, return only the hubids"
     __used_for__ = IQuerying
@@ -14,3 +13,16 @@
         # Not really optimal, this. May be a better way?
         reslist = IISet([ x[0] for x in reslist ])
         return reslist
+
+class SimpleKeywordQuery:
+    "Call an IKeywordQuerying search, return only the hubids"
+    __used_for__ = IKeywordQuerying
+
+    def __init__(self, index):
+        self._index = index
+
+    def query(self, term, start=0, count=None):
+        reslist = self._index.search(term, operator='and')
+        return reslist
+
+


=== Zope3/src/zope/app/index/configure.zcml 1.6 => 1.7 ===
--- Zope3/src/zope/app/index/configure.zcml:1.6	Mon Jul 14 04:31:12 2003
+++ Zope3/src/zope/app/index/configure.zcml	Sun Aug  3 01:41:07 2003
@@ -10,5 +10,13 @@
   permission="zope.Public"
 />
 
+<adapter
+  factory=".adapters.SimpleKeywordQuery"
+  provides="zope.index.interfaces.ISimpleQuery"
+  for="zope.index.interfaces.IKeywordQuerying"
+  permission="zope.Public"
+/>
+
 
 </zopeConfigure>
+




More information about the Zope3-Checkins mailing list