mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-17 11:41:11 +00:00
Remove any duplicate search fields of the same type
This commit is contained in:
parent
0aca9ece65
commit
5e76a54b2b
1 changed files with 7 additions and 0 deletions
|
|
@ -101,6 +101,13 @@ class Indexed(object):
|
|||
# Add the field
|
||||
search_fields.append(SearchField(field_name, boost=boost, partial_match=partial_match, es_extra=config))
|
||||
|
||||
# Remove any duplicate entries into search fields
|
||||
# We need to take into account that fields can be indexed as both a SearchField and as a FilterField
|
||||
search_fields_dict = {}
|
||||
for field in search_fields:
|
||||
search_fields_dict[(field.field_name, type(field))] = field
|
||||
search_fields = search_fields_dict.values()
|
||||
|
||||
return search_fields
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
Loading…
Reference in a new issue