Commit 0981258b5f24ef6dae860ef37b5aff755e4f1ed5
1 parent
7d24a4b7
Exists in
master
and in
39 other branches
Normalizing search queries #15
Showing
6 changed files
with
36 additions
and
13 deletions
Show diff stats
src/accounts/templates/search/indexes/accounts/user_text.txt
1 | 1 | {{ object.username }} |
2 | 2 | {{ object.get_full_name }} |
3 | -{{ object.email }} | |
3 | +{{ object.get_full_name|slugify }} | |
4 | 4 | {{ object.institution }} |
5 | +{{ object.institution|slugify }} | |
5 | 6 | {{ object.role }} |
6 | -{{ object.twitter }} | |
7 | -{{ object.facebook }} | |
8 | -{{ object.google_talk }} | |
9 | -{{ object.webpage }} | |
7 | +{{ object.role|slugify }} | ... | ... |
src/proxy/templates/search/indexes/proxy/revision_text.txt
1 | 1 | {{ object.repository_name }} |
2 | +{{ object.repository_name|slugify }} | |
2 | 3 | {{ object.revision }} |
4 | +{{ object.revision|slugify }} | |
3 | 5 | {% firstof object.get_author.get_full_name object.author %} |
6 | +{% firstof object.get_author.get_full_name|slugify object.author|slugify %} | |
4 | 7 | {{ object.message }} |
8 | +{{ object.message|slugify }} | ... | ... |
src/proxy/templates/search/indexes/proxy/ticket_text.txt
1 | 1 | {{ object.summary }} |
2 | +{{ object.summary|slugify }} | |
2 | 3 | {{ object.description }} |
4 | +{{ object.description|slugify }} | |
3 | 5 | {{ object.milestone }} |
4 | -{{ object.component }} | |
6 | +{{ object.milestone|slugify }} | |
7 | +{{ object.component|slugify }} | |
5 | 8 | {{ object.version }} |
6 | 9 | {{ object.severity }} |
10 | +{{ object.severity|slugify }} | |
7 | 11 | {{ object.reporter }} |
12 | +{{ object.reporter|slugify }} | |
8 | 13 | {% firstof object.get_author.get_fullname or object.author %} |
14 | +{% firstof object.get_author.get_fullname|slugify or object.author|slugify %} | |
9 | 15 | {{ object.status }} |
16 | +{{ object.status|slugify }} | |
10 | 17 | {{ object.keywords }} |
18 | +{{ object.keywords|slugify }} | |
11 | 19 | {{ object.collaborators }} |
20 | +{{ object.collaborators|slugify }} | ... | ... |
src/proxy/templates/search/indexes/proxy/wiki_text.txt
src/search/forms.py
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | |
3 | +import unicodedata | |
4 | + | |
3 | 5 | from django import forms |
4 | 6 | from django.utils.translation import ugettext_lazy as _ |
5 | 7 | from haystack.forms import SearchForm |
... | ... | @@ -17,7 +19,10 @@ class ColabSearchForm(SearchForm): |
17 | 19 | return self.no_query_found() |
18 | 20 | |
19 | 21 | if self.cleaned_data.get('q'): |
20 | - sqs = self.searchqueryset.auto_query(self.cleaned_data['q']) | |
22 | + q = unicodedata.normalize( | |
23 | + 'NFKD', unicode(self.cleaned_data.get('q')) | |
24 | + ).encode('ascii', 'ignore') | |
25 | + sqs = self.searchqueryset.auto_query(q) | |
21 | 26 | else: |
22 | 27 | sqs = self.searchqueryset.all() |
23 | 28 | |
... | ... | @@ -35,8 +40,6 @@ class ColabSearchForm(SearchForm): |
35 | 40 | # sqs = self.searchqueryset.models(Ticket) |
36 | 41 | # else: |
37 | 42 | # sqs = self.searchqueryset.all() |
38 | - else: | |
39 | - sqs = self.searchqueryset.models(User, Message) | |
40 | 43 | |
41 | 44 | |
42 | 45 | if self.load_all: | ... | ... |
src/super_archives/templates/search/indexes/super_archives/message_text.txt
1 | 1 | {{ object.thread.mailinglist.name }} |
2 | +{{ object.thread.mailinglist.name|slugify }} | |
2 | 3 | {{ object.thread.subject_token }} |
4 | + | |
3 | 5 | {{ object.body }} |
6 | +{{ object.body|slugify }} | |
4 | 7 | {{ object.subject_clean }} |
5 | -{{ object.url }} | |
6 | -{{ object.received_time }} | |
8 | +{{ object.subject_clean|slugify }} | |
9 | + | |
10 | +{{ object.from_address.get_full_name }} | ... | ... |