1.1 --- a/iixr/terms.py Sun Nov 21 20:44:43 2010 +0100
1.2 +++ b/iixr/terms.py Mon Nov 22 23:45:44 2010 +0100
1.3 @@ -40,6 +40,9 @@
1.4 term information file.
1.5 """
1.6
1.7 + if term <= self.last_term:
1.8 + raise ValueError, "Term %r precedes the previous term %r." % (term, self.last_term)
1.9 +
1.10 # Write the prefix length and term suffix.
1.11
1.12 common = len(commonprefix([self.last_term, term]))
1.13 @@ -193,6 +196,10 @@
1.14 """
1.15
1.16 offset, frequency, doc_frequency = self.position_dict_writer.write_term_positions(doc_positions)
1.17 +
1.18 + if not frequency or not doc_frequency:
1.19 + raise ValueError, "Term %r has no occurrences recorded: %r" % (term, doc_positions)
1.20 +
1.21 self._write_term(term, offset, frequency, doc_frequency)
1.22
1.23 def close(self):