From e0e80fdbb5891863a5971b84a2fac6f8e7f43f75 Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Wed, 6 Nov 2013 23:33:02 -0200 Subject: [PATCH] Adding q.alt parameter --- src/search/forms.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/search/forms.py b/src/search/forms.py index 020c7d2..dbab0fb 100644 --- a/src/search/forms.py +++ b/src/search/forms.py @@ -91,17 +91,18 @@ class ColabSearchForm(SearchForm): if self.cleaned_data['used_by']: sqs = sqs.filter_or(used_by__in=self.cleaned_data['used_by'].split()) - if self.cleaned_data.get('q'): - q = unicodedata.normalize( - 'NFKD', unicode(self.cleaned_data.get('q')) - ).encode('ascii', 'ignore') - sqs = sqs.filter(content=AltParser( - 'dismax', - q, - pf='title^2.1 author^1.9 description^1.7', - mm='2<70%', - bf='recip(ms(NOW/DAY,modified),3.16e-11,1,1)^10', - )) + q = unicodedata.normalize( + 'NFKD', unicode(self.cleaned_data.get('q')) + ).encode('ascii', 'ignore') + + dismax_opts = { + 'q.alt': '*.*', + 'pf': 'title^2.1 author^1.9 description^1.7', + 'mm': '2<70%', + 'bf': 'recip(ms(NOW/DAY,modified),3.16e-11,1,1)^10', + } + + sqs = sqs.filter(content=AltParser('dismax', q, **dismax_opts)) if self.cleaned_data['type']: sqs = sqs.filter(type=self.cleaned_data['type']) -- libgit2 0.21.2