diff options
author | Jacob Mason <jacoblmason@gmail.com> | 2010-08-09 14:43:32 -0500 |
---|---|---|
committer | Jacob Mason <jacoblmason@gmail.com> | 2010-08-09 14:43:32 -0500 |
commit | c5e43ca3c9aefa6191b862b17ed1a4136a0b12f3 (patch) | |
tree | 3c52d4ad87d6808b90c4c752fd1da883ff7c991e | |
parent | 71a14cdd34393c11ecc04c43859e6f5b36295b21 (diff) | |
download | sphinx-git-c5e43ca3c9aefa6191b862b17ed1a4136a0b12f3.tar.gz |
create a searcher for each query
-rw-r--r-- | sphinx/websupport/search/whooshsearch.py | 6 |
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']) |