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_profile
attribute was stored as a BooleanField
, but
there is a longstanding Haystack bug that results in boolean fields
always being returned from Whoosh as True
. This has been replaced with
a custom BooleanField with the correct behaviour.
-
The show_profile
as indexing the result of User.is_profile_visible()
,
which will always return False
when there is no user argument
supplied. Instead, we now store the is_private
attribute of
Profile
directly 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).