1.1 --- a/test_indexed.py Mon Oct 03 00:17:53 2011 +0200
1.2 +++ b/test_indexed.py Mon Oct 03 00:34:30 2011 +0200
1.3 @@ -14,6 +14,7 @@
1.4
1.5 f = open(filename)
1.6 accessor = DelimitedRecord(fields, numeric=(numeric == "true"))
1.7 +
1.8 try:
1.9 t = time.time()
1.10 l = make_index(f, accessor.get_key, int(interval))
1.11 @@ -21,9 +22,17 @@
1.12
1.13 # Now use the index.
1.14
1.15 + index = IndexedFile(f, l, accessor.get_key)
1.16 for term in terms:
1.17 +
1.18 + # Convert the term to the appropriate type.
1.19 +
1.20 + term = accessor.convert(term)
1.21 +
1.22 + # Perform the search.
1.23 +
1.24 t = time.time()
1.25 - line = find_with_index(f, accessor.get_key, l, accessor.convert(term))
1.26 + line = index.find(term)
1.27 if line:
1.28 print "Found (at %s seconds)...\n%s" % (time.time() - t, line)
1.29