Commit 6f647bb8 authored by 's avatar

- removed PluginIndexes.TextIndex dependencies (don't know if anybody uses these files)

parent bbe910a0
...@@ -8,6 +8,7 @@ Will create an index of all files in dir or its subdirectories. ...@@ -8,6 +8,7 @@ Will create an index of all files in dir or its subdirectories.
options: options:
-f data.fs -- the path to the filestorage datafile -f data.fs -- the path to the filestorage datafile
""" """
# XXX: Products.PluginIndexes.TextIndex no longer exists
from __future__ import nested_scopes from __future__ import nested_scopes
import os import os
...@@ -47,14 +48,14 @@ class MySplitter: ...@@ -47,14 +48,14 @@ class MySplitter:
return stopdict.get(w, w) return stopdict.get(w, w)
return filter(None, map(lookup, words)) return filter(None, map(lookup, words))
def make_old_index(): #def make_old_index():
from Products.PluginIndexes.TextIndex.TextIndex import TextIndex # from Products.PluginIndexes.TextIndex.TextIndex import TextIndex
from Products.PluginIndexes.TextIndex.Lexicon import Lexicon # from Products.PluginIndexes.TextIndex.Lexicon import Lexicon
from Products.ZCTextIndex.StopDict import get_stopdict # from Products.ZCTextIndex.StopDict import get_stopdict
#
l = Lexicon(get_stopdict()) # l = Lexicon(get_stopdict())
l.SplitterFunc = MySplitter() # l.SplitterFunc = MySplitter()
return TextIndex("read", lexicon=l) # return TextIndex("read", lexicon=l)
def main(db, root, dir): def main(db, root, dir):
rt["index"] = index = INDEX() rt["index"] = index = INDEX()
...@@ -135,8 +136,8 @@ if __name__ == "__main__": ...@@ -135,8 +136,8 @@ if __name__ == "__main__":
PACK_INTERVAL = int(v) PACK_INTERVAL = int(v)
if o == '-n': if o == '-n':
LIMIT = int(v) LIMIT = int(v)
if o == '-T': # if o == '-T':
INDEX = make_old_index # INDEX = make_old_index
if len(args) != 1: if len(args) != 1:
print "Expected on argument" print "Expected on argument"
......
# XXX: Products.PluginIndexes.TextIndex no longer exists
import os import os
from time import clock from time import clock
...@@ -27,7 +28,7 @@ def path2url(p): ...@@ -27,7 +28,7 @@ def path2url(p):
i += len(marker) i += len(marker)
return "http://www.python.org" + p[i:] return "http://www.python.org" + p[i:]
from Products.PluginIndexes.TextIndex.TextIndex import And, Or #from Products.PluginIndexes.TextIndex.TextIndex import And, Or
from Products.ZCTextIndex.tests.indexhtml import MySplitter from Products.ZCTextIndex.tests.indexhtml import MySplitter
from Products.ZCTextIndex.NBest import NBest from Products.ZCTextIndex.NBest import NBest
...@@ -106,8 +107,8 @@ if __name__ == "__main__": ...@@ -106,8 +107,8 @@ if __name__ == "__main__":
VERBOSE += 1 VERBOSE += 1
if o == '-f': if o == '-f':
FSPATH = v FSPATH = v
if o == '-T': # if o == '-T':
TEXTINDEX = 1 # TEXTINDEX = 1
fs = FileStorage(FSPATH, read_only=1) fs = FileStorage(FSPATH, read_only=1)
db = ZODB.DB(fs, cache_size=10000) db = ZODB.DB(fs, cache_size=10000)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment