I've just fixed the imports so people using SearchIndex out of Zope have
success importing it. Andrew's setup.py can be used if you remove the
parts from it that refer to query (it's attached so people can use it if
they like). I'm using CVS SearchIndex (from the Zope2 branch) but there's
probably little change.

I'm starting to work on documenting them on wiki.async.com.br, and soon I
hope to have a HOWTO we can add to Andrew's if he likes.

Take care,
--
/\/\ Christian Reis, Senior Engineer, Async Open Source, Brazil
~\/~ http://async.com.br/~kiko/ | [+55 16] 274 4311
#!/usr/bin/env python

# Setup file for SearchIndex package
# Code by Digital Creations <http://www.digicool.com>
# setup.py written by A.M. Kuchling <[EMAIL PROTECTED]>

from distutils.core import setup
from distutils.extension import Extension

splitter = Extension(name = 'SearchIndex.Splitter',
                         sources= ['Splitter.c']
                         )
setup(name = "SearchIndex", 
      version = "2.2.1",
      description = "Collected utilities to support database indexing",
      author = "Digital Creations",
      author_email = "[EMAIL PROTECTED]",
      url = "http://www.zope.org";,

      packages=['SearchIndex'],
      package_dir = {'SearchIndex':'.'},
      
      ext_modules = [splitter],
      )

? diff
? build
? setup.py
? ChangeLog
Index: Index.py
===================================================================
RCS file: /cvs-repository/Zope2/lib/python/SearchIndex/Index.py,v
retrieving revision 1.28
diff -u -r1.28 Index.py
--- Index.py    2001/03/15 13:16:24     1.28
+++ Index.py    2001/05/24 17:34:43
@@ -86,9 +86,11 @@
 """Simple column indices"""
 __version__='$Revision: 1.28 $'[11:-2]
 
+import ZODB
 from Persistence import Persistent
 from BTrees.OOBTree import OOBTree
 from BTrees.IIBTree import IITreeSet
+from BTrees.IIBTree import weightedIntersection, weightedUnion, difference
 import operator
 from Missing import MV
 import string
@@ -205,7 +207,12 @@
 
 
     def index_item(self, i, obj=None):
-        """Recompute index data for data with ids >= start."""
+        """Add an item to the index.
+                          i is the index position the object is stored in self._index
+
+               obj is the object to be indexed. The object should
+               include the attribute indicated by self.id.
+        """
         index = self._index
         id = self.id
         if (self._schema is None) or (obj is not None):
@@ -230,7 +237,7 @@
 
 
     def unindex_item(self, i, obj=None):
-        """Recompute index data for data with ids >= start."""
+        """Remove item from index."""
         index = self._index
         id = self.id
         if self._schema is None:
@@ -279,6 +286,7 @@
         elif has_key(id): keys = request[id]
         else: return None
 
+               # in case there was only a single key we are looking for
         if type(keys) is not ListType: keys=[keys]
         index = self._index
         r = None
@@ -312,7 +320,7 @@
                     w, r = weightedUnion(r, set)
 
         if r is None:
-            if anyTrue: r=IISet()
+            if anyTrue: r=IITreeSet()
             else: return None
 
         return r, (id,)
Index: Lexicon.py
===================================================================
RCS file: /cvs-repository/Zope2/lib/python/SearchIndex/Lexicon.py,v
retrieving revision 1.18
diff -u -r1.18 Lexicon.py
--- Lexicon.py  2001/03/15 13:16:24     1.18
+++ Lexicon.py  2001/05/24 17:34:43
@@ -89,6 +89,7 @@
 
 """
 
+import ZODB
 from Splitter import Splitter
 from Persistence import Persistent
 from Acquisition import Implicit
Index: TextIndex.py
===================================================================
RCS file: /cvs-repository/Zope2/lib/python/SearchIndex/TextIndex.py,v
retrieving revision 1.29
diff -u -r1.29 TextIndex.py
--- TextIndex.py        2001/04/27 18:07:14     1.29
+++ TextIndex.py        2001/05/24 17:34:44
@@ -206,7 +206,8 @@
 
 #XXX I strongly suspect that this is broken, but I'm not going to fix it. :(
 
-from Globals import Persistent
+import ZODB
+from Persistence import Persistent
 from BTrees.OOBTree import OOBTree
 from BTrees.IIBTree import IISet, IIBucket
 import operator
Index: UnIndex.py
===================================================================
RCS file: /cvs-repository/Zope2/lib/python/SearchIndex/UnIndex.py,v
retrieving revision 1.29
diff -u -r1.29 UnIndex.py
--- UnIndex.py  2001/04/17 17:05:49     1.29
+++ UnIndex.py  2001/05/24 17:34:44
@@ -87,10 +87,9 @@
 
 __version__='$Revision: 1.29 $'[11:-2]
 
-from Globals import Persistent
+import ZODB
+from Persistence import Persistent
 from Acquisition import Implicit
-import BTree
-import IOBTree
 import string
 from zLOG import LOG, ERROR
 from types import StringType, ListType, IntType, TupleType
Index: UnTextIndex.py
===================================================================
RCS file: /cvs-repository/Zope2/lib/python/SearchIndex/UnTextIndex.py,v
retrieving revision 1.48
diff -u -r1.48 UnTextIndex.py
--- UnTextIndex.py      2001/05/03 11:09:12     1.48
+++ UnTextIndex.py      2001/05/24 17:34:44
@@ -97,7 +97,8 @@
 import string, re
 import operator
 
-from Globals import Persistent
+import ZODB
+from Persistence import Persistent
 from Acquisition import Implicit
 from Splitter import Splitter
 from zLOG import LOG, ERROR

Reply via email to