1.1 --- a/iixr/terms.py Sat Sep 19 21:42:55 2009 +0200
1.2 +++ b/iixr/terms.py Tue Sep 22 01:08:13 2009 +0200
1.3 @@ -20,6 +20,7 @@
1.4
1.5 from iixr.files import *
1.6 from iixr.positions import *
1.7 +from iixr.phrases import PhraseIterator
1.8 from os.path import commonprefix # to find common string prefixes
1.9 from bisect import bisect_right # to find terms in the dictionary index
1.10
1.11 @@ -376,6 +377,15 @@
1.12 offset, frequency, doc_frequency = t
1.13 return self._get_positions(offset, doc_frequency)
1.14
1.15 + def find_common_positions(self, terms):
1.16 +
1.17 + """
1.18 + Return the documents and positions at which all the given 'terms' are
1.19 + found, where only common documents are returned.
1.20 + """
1.21 +
1.22 + return PhraseIterator([self.find_positions(term) for term in terms])
1.23 +
1.24 def get_frequency(self, term):
1.25
1.26 "Return the frequency of the given 'term'."