Only index full names for Users with public profiles
Review Request #9924 — Created May 10, 2018 and submitted — Latest diff uploaded
Previously we were indexing the full name, which allowed users to search
by full name. However, if a user has marked their profile as private, we
do not want them to be searchable by their name.Additionally, this patch addresses two further issues:
The
show_profileattribute was stored as aBooleanField, but
there is a longstanding Haystack bug that results in boolean fields
always being returned from Whoosh asTrue. This has been replaced with
a custom BooleanField with the correct behaviour.
The
show_profileas indexing the result ofUser.is_profile_visible(),
which will always returnFalsewhen there is no user argument
supplied. Instead, we now store theis_privateattribute of
Profiledirectly on the index.Finally, the search API has been updated to strip the full name out of
results when using the database query backend (i.e., when either search
or on-the-fly indexing is disabled).
Ran unit tests.
