1.1 --- a/simplex/__init__.py Sun Oct 02 19:52:30 2011 +0200
1.2 +++ b/simplex/__init__.py Sun Oct 02 20:43:03 2011 +0200
1.3 @@ -29,42 +29,9 @@
1.4 """
1.5
1.6 from simplex.readers import *
1.7 +from simplex.indexers import *
1.8 import bisect
1.9
1.10 -def make_index(reader, get_key, interval):
1.11 -
1.12 - """
1.13 - Index a resource whose 'reader' provides records, using a 'get_key'
1.14 - operation to yield the key for such records, creating an index entry for a
1.15 - record after a given number of records, defined by 'interval', have been
1.16 - read since the last entry was produced.
1.17 - """
1.18 -
1.19 - l = []
1.20 - pos = 0
1.21 -
1.22 - current_key = None
1.23 - start_pos = 0
1.24 -
1.25 - for i, record in enumerate(reader):
1.26 - key = get_key(record)
1.27 -
1.28 - # Where duplicate keys are permitted, the first record employing the key
1.29 - # must be available as an index entry. Otherwise, records preceding the
1.30 - # one referenced by the entry may have the same key and be missed when
1.31 - # seeking using the index.
1.32 -
1.33 - if key != current_key:
1.34 - current_key = key
1.35 - start_pos = pos
1.36 -
1.37 - if i % interval == 0:
1.38 - l.append((current_key, start_pos))
1.39 -
1.40 - pos += len(record)
1.41 -
1.42 - return l
1.43 -
1.44 def find_with_index(reader, get_key, l, term):
1.45
1.46 """