Skip to content

Commit

Permalink
personal: Use index.AutocompleteField
Browse files Browse the repository at this point in the history
Wagtail is changing its search API [1]. There is a documentation PR pending at [2].

Our automplete hack - patch to make Wagtail Snippet Chooser use
.autocomplete() instead of .search() - stopped working after the Wagtail
update for the Contact snippet. Use wagtail.search.index.AutocompleteField
in Contact model to specify, which fields should be indexed for autocompletion.

[1] https://github.com/wagtail/wagtail/issues/4937
[2] https://github.com/wagtail/wagtail/issues/4938
  • Loading branch information
donald committed Aug 15, 2020
1 parent 207aa12 commit 3da67a8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mpicms/personal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,11 @@ class Contact(index.Indexed, ClusterableModel):

search_fields = [
index.SearchField('first_name', partial_match=True),
index.AutocompleteField('first_name'),
index.SearchField('last_name', partial_match=True),
index.AutocompleteField('last_name'),
index.SearchField('email', partial_match=True),
index.AutocompleteField('email'),
index.SearchField('phone'),
index.SearchField('room'),
index.FilterField('is_active')
Expand Down

0 comments on commit 3da67a8

Please sign in to comment.