Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
molgen
/
mpicms
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
20
Pull requests
0
Actions
Projects
0
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security
Insights
Files
master
config
docs
locale
mpicms
patches
Fix-typo-in-ogg-media-format-description.patch
django-Do-not-check-ALLOWED_HOSTS-for-dummy-requests.patch
documents-and-images-support-partial-matches.patch
hack-snippets-chooser-to-use-autocomplete.patch
requirements
.coveragerc
.gitignore
.travis.yml
README.md
manage.py
pytest.ini
setup.cfg
Breadcrumbs
mpicms
/
patches
/
documents-and-images-support-partial-matches.patch
Blame
Blame
Latest commit
History
History
75 lines (65 loc) · 3.33 KB
Breadcrumbs
mpicms
/
patches
/
documents-and-images-support-partial-matches.patch
Top
File metadata and controls
Code
Blame
75 lines (65 loc) · 3.33 KB
Raw
From dffa61c525b20f4c0f28e2cd6c045abb31c424f4 Mon Sep 17 00:00:00 2001 From: Donald Buczek <buczek@molgen.mpg.de> Date: Thu, 2 Jan 2020 15:23:36 +0100 Subject: [PATCH] documents/images: Support partial match on search The postgres_search backend currently doesn't support partial searches in its search() method. The index and the autocomplete method, however do. Enable partial matches for wagtails backend view and chooser by using .autocomplete instead of .search. This is a workaround and should be replaced by a cleaner approach. --- lib/python3.7/site-packages/wagtail/documents/views/chooser.py | 2 +- .../site-packages/wagtail/documents/views/documents.py | 2 +- lib/python3.7/site-packages/wagtail/images/views/chooser.py | 2 +- lib/python3.7/site-packages/wagtail/images/views/images.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/python3.7/site-packages/wagtail/documents/views/chooser.py b/lib/python3.7/site-packages/wagtail/documents/views/chooser.py index 6adc3aa..dee0087 100644 --- a/lib/python3.7/site-packages/wagtail/documents/views/chooser.py +++ b/lib/python3.7/site-packages/wagtail/documents/views/chooser.py @@ -71,7 +71,7 @@ def chooser(request): if searchform.is_valid(): q = searchform.cleaned_data['q'] - documents = documents.search(q) + documents = documents.autocomplete(q) is_searching = True else: documents = documents.order_by('-created_at') diff --git a/lib/python3.7/site-packages/wagtail/documents/views/documents.py b/lib/python3.7/site-packages/wagtail/documents/views/documents.py index 4ce20fe..1228b95 100644 --- a/lib/python3.7/site-packages/wagtail/documents/views/documents.py +++ b/lib/python3.7/site-packages/wagtail/documents/views/documents.py @@ -55,7 +55,7 @@ def index(request): form = SearchForm(request.GET, placeholder=_("Search documents")) if form.is_valid(): query_string = form.cleaned_data['q'] - documents = documents.search(query_string) + documents = documents.autocomplete(query_string) else: form = SearchForm(placeholder=_("Search documents")) diff --git a/lib/python3.7/site-packages/wagtail/images/views/chooser.py b/lib/python3.7/site-packages/wagtail/images/views/chooser.py index b36095e..b576f5d 100644 --- a/lib/python3.7/site-packages/wagtail/images/views/chooser.py +++ b/lib/python3.7/site-packages/wagtail/images/views/chooser.py @@ -101,7 +101,7 @@ def chooser(request): if searchform.is_valid(): q = searchform.cleaned_data['q'] - images = images.search(q) + images = images.autocomplete(q) is_searching = True else: is_searching = False diff --git a/lib/python3.7/site-packages/wagtail/images/views/images.py b/lib/python3.7/site-packages/wagtail/images/views/images.py index edb1c40..e030224 100644 --- a/lib/python3.7/site-packages/wagtail/images/views/images.py +++ b/lib/python3.7/site-packages/wagtail/images/views/images.py @@ -48,7 +48,7 @@ def index(request): if form.is_valid(): query_string = form.cleaned_data['q'] - images = images.search(query_string) + images = images.autocomplete(query_string) else: form = SearchForm(placeholder=_("Search images")) -- 2.26.2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
You can’t perform that action at this time.