Skip to content

Commit 2b1b651

Browse files
author
Richard Jones
committed
cleaned up the indexer code:
- it splits more words out (much simpler, faster splitter) - removed code we'll never use (roundup.roundup_indexer has the full implementation, and replaces roundup.indexer) - only index text/plain and rfc822/message (ideas for other text formats to index are welcome) - added simple unit test for indexer. Needs more tests for regression.
1 parent 7cce904 commit 2b1b651

File tree

5 files changed

+328
-827
lines changed

5 files changed

+328
-827
lines changed

CHANGES.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
This file contains the changes to the Roundup system over time. The entries
22
are given with the most recent entry first.
33

4-
2002-??-?? 0.?.?
4+
2002-??-?? 0.5.0
55
Fixed:
66
. #576086 ] dumb copying mistake (frontends/ZRoundup.py)
77
. installation instructions now mention "python2" in "testing your python".
8+
. cleaned up the indexer code:
9+
- it splits more words out
10+
- removed code we'll never use (roundup.roundup_indexer has the full
11+
implementation, and replaces roundup.indexer)
12+
- only index text/plain and rfc822/message (ideas for other text formats to
13+
index are welcome)
14+
- added simple unit test for indexer. Needs more tests for regression.
15+
. made the unit tests run again - they were quite b0rken
816

917

1018
2002-06-24 0.4.2

roundup/backends/back_anydbm.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_anydbm.py,v 1.37 2002-06-20 23:52:35 richard Exp $
18+
#$Id: back_anydbm.py,v 1.38 2002-07-08 06:58:15 richard Exp $
1919
'''
2020
This module defines a backend that saves the hyperdatabase in a database
2121
chosen by anydbm. It is guaranteed to always be available in python
@@ -26,7 +26,7 @@
2626
import whichdb, anydbm, os, marshal
2727
from roundup import hyperdb, date
2828
from blobfiles import FileStorage
29-
from roundup.roundup_indexer import RoundupIndexer
29+
from roundup.indexer import Indexer
3030
from locking import acquire_lock, release_lock
3131

3232
#
@@ -62,7 +62,7 @@ def __init__(self, config, journaltag=None):
6262
self.dirtynodes = {} # keep track of the dirty nodes by class
6363
self.newnodes = {} # keep track of the new nodes by class
6464
self.transactions = []
65-
self.indexer = RoundupIndexer(self.dir)
65+
self.indexer = Indexer(self.dir)
6666
# ensure files are group readable and writable
6767
os.umask(0002)
6868

@@ -160,7 +160,7 @@ def _opendb(self, name, mode):
160160
except ImportError:
161161
raise hyperdb.DatabaseError, \
162162
"Couldn't open database - the required module '%s'"\
163-
"is not available"%db_type
163+
" is not available"%db_type
164164
if __debug__:
165165
print >>hyperdb.DEBUG, "_opendb %r.open(%r, %r)"%(db_type, path,
166166
mode)
@@ -486,6 +486,9 @@ def rollback(self):
486486

487487
#
488488
#$Log: not supported by cvs2svn $
489+
#Revision 1.37 2002/06/20 23:52:35 richard
490+
#More informative error message
491+
#
489492
#Revision 1.36 2002/06/19 03:07:19 richard
490493
#Moved the file storage commit into blobfiles where it belongs.
491494
#

roundup/backends/blobfiles.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: blobfiles.py,v 1.4 2002-06-19 03:07:19 richard Exp $
18+
#$Id: blobfiles.py,v 1.5 2002-07-08 06:58:15 richard Exp $
1919
'''
2020
This module exports file storage for roundup backends.
2121
Files are stored into a directory hierarchy.
2222
'''
2323

24-
import os, os.path
24+
import os
2525

2626
def files_in_dir(dir):
2727
if not os.path.exists(dir):
@@ -106,11 +106,13 @@ def _doStoreFile(self, name, **databases):
106106
'''
107107
# the file is currently ".tmp" - move it to its real name to commit
108108
os.rename(name+".tmp", name)
109-
pattern = name.split('/')[-1]
110-
self.indexer.add_files(dir=os.path.dirname(name), pattern=pattern)
109+
self.indexer.add_file(name)
111110
self.indexer.save_index()
112111

113112
# $Log: not supported by cvs2svn $
113+
# Revision 1.4 2002/06/19 03:07:19 richard
114+
# Moved the file storage commit into blobfiles where it belongs.
115+
#
114116
# Revision 1.3 2002/02/27 07:33:34 grubert
115117
# . add, vim line and cvs log key.
116118
#

0 commit comments

Comments
 (0)