• 
      
    Fish Trophy

    dan.casares got a fish trophy!

    Fish Trophy

    Search: Add faceted fields to ReviewRequestIndex and UserIndex

    Review Request #15051 — Created May 13, 2026 and updated — Latest diff uploaded

    Information

    Review Board
    release-8.x

    Reviewers

    Extends ReviewRequestIndex and UserIndex with new Elasticsearch-specific
    fields required by the faceted search engine. These fields are ignored by
    Whoosh.

    ReviewRequestIndex gains:
    - status, branchCharField(faceted=True) for status and branch
    filters and aggregations
    - repository_id, submitter_idIntegerField FKs for the repository
    and author searchable filters
    - date_created, date_updateddatetime fields for creation and
    last-updated range filters
    - target_reviewer_ids, reviewer_user_ids, commenter_user_ids
    multi-value integer fields for reviewer and commenter filters
    - has_ship_it, has_reviews, has_issues_open, has_file_attachment,
    has_depends_onBooleanField for option-count term queries
    - comment_issue_statuses, file_attachment_types — multi-value fields
    for issue status and file type filters

    The review-based boolean fields (has_ship_it, has_reviews,
    reviewer_user_ids) use the prefetched _public_reviews attribute when
    available during rebuild_index and fall back to direct DB queries during
    on-the-fly indexing. has_issues_open and commenter_user_ids always use
    direct DB queries since comment volumes can be very large.

    UserIndex gains:
    - is_active, is_staffBooleanField(faceted=True) for user status
    and role filters
    - group_ids — multi-value field for group membership filter
    - date_joined, last_login — datetime fields for date range filters
    - username_display — stored keyword copy of username for terms
    aggregations

    UserIndex.index_queryset now indexes all users regardless of their
    is_active status (the is_active=True filter has been removed).
    Inactive users now appear in search results by default and can be filtered
    out using the is_active faceted field.

    A new GroupIndex is introduced to support the groups search tab. It
    indexes:
    - has_open_review_requests, in_active_reviewsBooleanField for
    filtering groups by review request activity
    - member_countIntegerField for filtering groups by membership size
    - invite_onlyBooleanField used by the permission filter to exclude
    groups the searching user cannot access

    A rebuild_index is required after upgrading to populate these new fields.

    Ran full test suite.
    Verified that each new prepare_* method on ReviewRequestIndex and
    UserIndex returns the correct value, including fallback behaviour for
    on-the-fly indexing when prefetches are not available. Confirmed that
    index_queryset on both indexes does not introduce N+1 queries for any of the
    new fields.

    Commits

    Files