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