From d47aeafe64890c36e33d2071f9e93ca44108a593 Mon Sep 17 00:00:00 2001 From: Gust Date: Wed, 24 Jun 2015 10:47:55 -0300 Subject: [PATCH] Change AltParser if engine is whoosh --- colab/search/forms.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/colab/search/forms.py b/colab/search/forms.py index 04ef66e..c50d3c1 100644 --- a/colab/search/forms.py +++ b/colab/search/forms.py @@ -7,6 +7,7 @@ from django.conf import settings from django.utils.translation import ugettext_lazy as _ from haystack.forms import SearchForm from haystack.inputs import AltParser +from haystack.inputs import AutoQuery from colab.super_archives.models import MailingList @@ -107,7 +108,11 @@ class ColabSearchForm(SearchForm): 'bf': 'recip(ms(NOW/HOUR,modified),3.16e-11,1,1)^10', } - sqs = sqs.filter(content=AltParser('edismax', q, **dismax_opts)) + if settings.HAYSTACK_CONNECTIONS['default']['ENGINE'] != \ + 'haystack.backends.whoosh_backend.WhooshEngine': + sqs = sqs.filter(content=AltParser('edismax', q, **dismax_opts)) + else: + sqs = sqs.filter(content=AutoQuery(q)) if self.cleaned_data['type']: sqs = sqs.filter(type=self.cleaned_data['type']) -- libgit2 0.21.2