1.1 --- a/simplex.py Fri Sep 30 23:46:27 2011 +0200
1.2 +++ b/simplex.py Sat Oct 01 00:01:04 2011 +0200
1.3 @@ -65,9 +65,24 @@
1.4 l = []
1.5 pos = 0
1.6
1.7 + current_key = None
1.8 + start_pos = 0
1.9 +
1.10 for i, record in enumerate(f.get_records()):
1.11 + key = f.get_key(record)
1.12 +
1.13 + # Where duplicate keys are permitted, the first record employing the key
1.14 + # must be available as an index entry. Otherwise, records preceding the
1.15 + # one referenced by the entry may have the same key and be missed when
1.16 + # seeking using the index.
1.17 +
1.18 + if key != current_key:
1.19 + current_key = key
1.20 + start_pos = pos
1.21 +
1.22 if i % interval == 0:
1.23 - l.append((f.get_key(record), pos))
1.24 + l.append((current_key, start_pos))
1.25 +
1.26 pos += len(record)
1.27
1.28 return l