Fixes #11232: Enable partial & regex matching for non-string types in global search

This commit is contained in:
jeremystretch
2022-12-22 09:14:57 -05:00
parent 790bcc9cb8
commit 2018e16e7f
2 changed files with 6 additions and 2 deletions

View File

@@ -99,8 +99,8 @@ class CachedValueSearchBackend(SearchBackend):
params = {
f'value__{lookup}': value
}
if lookup != LookupTypes.EXACT:
# Partial matches are valid only on string values
if lookup in (LookupTypes.STARTSWITH, LookupTypes.ENDSWITH):
# Partial string matches are valid only on string values
params['type'] = FieldTypes.STRING
if object_types:
params['object_type__in'] = object_types