In personsidebarfilter, search on each part of name

Instead of requiring that the entire search string matches a single one of the Person's names, the function will require that each word in the search string matches any of the Person's name fields.

Fixes #7950
This commit is contained in:
Richard Clay 2018-10-03 20:16:49 +01:00 committed by Nick Hall
parent cfa278886b
commit dd9ddab849

View File

@ -186,7 +186,9 @@ class PersonSidebarFilter(SidebarFilter):
# if the name is not empty, choose either the regular expression
# version or the normal text match
if name:
rule = RegExpName([name], use_regex=regex)
name_parts = name.split(sep=" ")
for name_part in name_parts:
rule = RegExpName([name_part], use_regex=regex)
generic_filter.add_rule(rule)
# if the id is not empty, choose either the regular expression