Commit e0e80fdbb5891863a5971b84a2fac6f8e7f43f75
1 parent
8343c8a3
Exists in
master
and in
39 other branches
Adding q.alt parameter
Showing
1 changed file
with
12 additions
and
11 deletions
Show diff stats
src/search/forms.py
@@ -91,17 +91,18 @@ class ColabSearchForm(SearchForm): | @@ -91,17 +91,18 @@ class ColabSearchForm(SearchForm): | ||
91 | if self.cleaned_data['used_by']: | 91 | if self.cleaned_data['used_by']: |
92 | sqs = sqs.filter_or(used_by__in=self.cleaned_data['used_by'].split()) | 92 | sqs = sqs.filter_or(used_by__in=self.cleaned_data['used_by'].split()) |
93 | 93 | ||
94 | - if self.cleaned_data.get('q'): | ||
95 | - q = unicodedata.normalize( | ||
96 | - 'NFKD', unicode(self.cleaned_data.get('q')) | ||
97 | - ).encode('ascii', 'ignore') | ||
98 | - sqs = sqs.filter(content=AltParser( | ||
99 | - 'dismax', | ||
100 | - q, | ||
101 | - pf='title^2.1 author^1.9 description^1.7', | ||
102 | - mm='2<70%', | ||
103 | - bf='recip(ms(NOW/DAY,modified),3.16e-11,1,1)^10', | ||
104 | - )) | 94 | + q = unicodedata.normalize( |
95 | + 'NFKD', unicode(self.cleaned_data.get('q')) | ||
96 | + ).encode('ascii', 'ignore') | ||
97 | + | ||
98 | + dismax_opts = { | ||
99 | + 'q.alt': '*.*', | ||
100 | + 'pf': 'title^2.1 author^1.9 description^1.7', | ||
101 | + 'mm': '2<70%', | ||
102 | + 'bf': 'recip(ms(NOW/DAY,modified),3.16e-11,1,1)^10', | ||
103 | + } | ||
104 | + | ||
105 | + sqs = sqs.filter(content=AltParser('dismax', q, **dismax_opts)) | ||
105 | 106 | ||
106 | if self.cleaned_data['type']: | 107 | if self.cleaned_data['type']: |
107 | sqs = sqs.filter(type=self.cleaned_data['type']) | 108 | sqs = sqs.filter(type=self.cleaned_data['type']) |