#!/usr/bin/python2.6 # coding: utf-8 from whoosh.index import open_dir from whoosh.qparser import QueryParser index = open_dir(u"index", mapped=False) searcher = index.searcher() while True: term = raw_input("query> ") query = QueryParser("content").parse(term) print query results = searcher.search(query) for result in results: print "Match in {0}".format(result.get("path")) print "{0} results".format(len(results))