summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Mason <jacoblmason@gmail.com>2010-08-09 14:43:32 -0500
committerJacob Mason <jacoblmason@gmail.com>2010-08-09 14:43:32 -0500
commitc5e43ca3c9aefa6191b862b17ed1a4136a0b12f3 (patch)
tree3c52d4ad87d6808b90c4c752fd1da883ff7c991e
parent71a14cdd34393c11ecc04c43859e6f5b36295b21 (diff)
downloadsphinx-git-c5e43ca3c9aefa6191b862b17ed1a4136a0b12f3.tar.gz
create a searcher for each query
-rw-r--r--sphinx/websupport/search/whooshsearch.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/sphinx/websupport/search/whooshsearch.py b/sphinx/websupport/search/whooshsearch.py
index 257393a6a..0f4635314 100644
--- a/sphinx/websupport/search/whooshsearch.py
+++ b/sphinx/websupport/search/whooshsearch.py
@@ -31,7 +31,6 @@ class WhooshSearch(BaseSearch):
self.index = index.open_dir(db_path)
else:
self.index = index.create_in(db_path, schema=self.schema)
- self.searcher = self.index.searcher()
def init_indexing(self, changed=[]):
for changed_path in changed:
@@ -40,8 +39,6 @@ class WhooshSearch(BaseSearch):
def finish_indexing(self):
self.index_writer.commit()
- # Create a new searcher so changes can be seen immediately
- self.searcher = self.index.searcher()
def add_document(self, pagename, title, text):
self.index_writer.add_document(path=unicode(pagename),
@@ -49,7 +46,8 @@ class WhooshSearch(BaseSearch):
text=text)
def handle_query(self, q):
- whoosh_results = self.searcher.find('text', q)
+ searcher = self.index.searcher()
+ whoosh_results = searcher.find('text', q)
results = []
for result in whoosh_results:
context = self.extract_context(result['text'])