def phraseSearch(self, field, words): "Search for a phrase (given as a list of words) in C{field}." q = PhraseQuery() for word in words: t = Term(field, word) q.add(t) return q
def phraseSearch(qStr, field='body'): """Find all docs containing the phrase C{qStr}.""" parts = qStr.split() q = PhraseQuery() for p in parts: t = Term(field, p) q.add(t) return q