Only index full names for Users with public profiles

Review Request #9924 — Created May 10, 2018 and submitted — Latest diff uploaded

Information

Review Board
release-3.0.x
ed0c3ef...

Reviewers

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:

  1. 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.

  2. 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).

Ran unit tests.