[Zope-CVS] CVS: Products/ZCTextIndex/tests - mailtest.py:1.1.2.18
Fred L. Drake, Jr.
fdrake@acm.org
Thu, 9 May 2002 15:18:17 -0400
Update of /cvs-repository/Products/ZCTextIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv7230
Modified Files:
Tag: TextIndexDS9-branch
mailtest.py
Log Message:
Update to work with the ZCTextIndex changes.
=== Products/ZCTextIndex/tests/mailtest.py 1.1.2.17 => 1.1.2.18 ===
import ZODB
import ZODB.FileStorage
-from Products.ZCTextIndex.ZCTextIndex import ZCTextIndex
+from Products.ZCTextIndex.Lexicon import Lexicon
+from Products.ZCTextIndex.ZCTextIndex import ZCTextIndex, \
+ CaseNormalizer, Splitter, StopWordRemover
from BTrees.IOBTree import IOBTree
import sys
@@ -63,12 +65,21 @@
self.text = summary + msg.fp.read()
Message.total_bytes += len(self.text)
+class Extra:
+ pass
+
def index(rt, mboxfile, db):
global NUM
idx_time = 0
pack_time = 0
- rt["index"] = idx = ZCTextIndex("text")
+ lexicon = Lexicon(Splitter(), CaseNormalizer(), StopWordRemover())
+ extra = Extra()
+ extra.lexicon_id = 'lexicon'
+ extra.doc_attr = 'text'
+ caller = Extra()
+ caller.lexicon = lexicon
+ rt["index"] = idx = ZCTextIndex(extra, caller)
if not EXCLUDE_TEXT:
rt["documents"] = docs = IOBTree()
get_transaction().commit()
@@ -175,6 +186,7 @@
query_str = None
mbox_path = None
profile = None
+ clean = 0
try:
opts, args = getopt.getopt(sys.argv[1:], 'vn:p:i:q:b:xt:',
['profile='])