Commit e6eb9a9f8c27f4559b238df3f30eb63e66575977
Committed by
Sergio Oliveira
1 parent
2a4ab7a6
Exists in
master
and in
31 other branches
Change AltParser if engine is whoosh
Signed-off-by: Gustavo Jaruga <darksshades@gmail.com> Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
Showing
1 changed file
with
6 additions
and
1 deletions
Show diff stats
colab/search/forms.py
| ... | ... | @@ -7,6 +7,7 @@ from django.conf import settings |
| 7 | 7 | from django.utils.translation import ugettext_lazy as _ |
| 8 | 8 | from haystack.forms import SearchForm |
| 9 | 9 | from haystack.inputs import AltParser |
| 10 | +from haystack.inputs import AutoQuery | |
| 10 | 11 | |
| 11 | 12 | from colab.super_archives.models import MailingList |
| 12 | 13 | |
| ... | ... | @@ -107,7 +108,11 @@ class ColabSearchForm(SearchForm): |
| 107 | 108 | 'bf': 'recip(ms(NOW/HOUR,modified),3.16e-11,1,1)^10', |
| 108 | 109 | } |
| 109 | 110 | |
| 110 | - sqs = sqs.filter(content=AltParser('edismax', q, **dismax_opts)) | |
| 111 | + if settings.HAYSTACK_CONNECTIONS['default']['ENGINE'] != \ | |
| 112 | + 'haystack.backends.whoosh_backend.WhooshEngine': | |
| 113 | + sqs = sqs.filter(content=AltParser('edismax', q, **dismax_opts)) | |
| 114 | + else: | |
| 115 | + sqs = sqs.filter(content=AutoQuery(q)) | |
| 111 | 116 | |
| 112 | 117 | if self.cleaned_data['type']: |
| 113 | 118 | sqs = sqs.filter(type=self.cleaned_data['type']) | ... | ... |