summaryrefslogtreecommitdiff
path: root/sphinx/websupport/search
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-08-21 23:59:40 +0200
committerGeorg Brandl <georg@python.org>2010-08-21 23:59:40 +0200
commit8824e63b058cd57532d55ee6df6438af1fc88546 (patch)
treea3e9e1069bfb0ad77144391373a0f43e7cfd2482 /sphinx/websupport/search
parent7b23361e75f65e6bb2dd566bb9ca840c343d541c (diff)
downloadsphinx-8824e63b058cd57532d55ee6df6438af1fc88546.tar.gz
Use different Whoosh API in order to fix test failure.
Diffstat (limited to 'sphinx/websupport/search')
-rw-r--r--sphinx/websupport/search/whooshsearch.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sphinx/websupport/search/whooshsearch.py b/sphinx/websupport/search/whooshsearch.py
index d395dcd7..e58c7342 100644
--- a/sphinx/websupport/search/whooshsearch.py
+++ b/sphinx/websupport/search/whooshsearch.py
@@ -11,6 +11,7 @@
from whoosh import index
from whoosh.fields import Schema, ID, TEXT
+from whoosh.qparser import QueryParser
from whoosh.analysis import StemmingAnalyzer
from sphinx.util.osutil import ensuredir
@@ -31,6 +32,7 @@ class WhooshSearch(BaseSearch):
self.index = index.open_dir(db_path)
else:
self.index = index.create_in(db_path, schema=self.schema)
+ self.qparser = QueryParser('text', self.schema)
def init_indexing(self, changed=[]):
for changed_path in changed:
@@ -47,7 +49,7 @@ class WhooshSearch(BaseSearch):
def handle_query(self, q):
searcher = self.index.searcher()
- whoosh_results = searcher.find('text', q)
+ whoosh_results = searcher.search(self.qparser.parse(q))
results = []
for result in whoosh_results:
context = self.extract_context(result['text'])