dan.casares got a fish trophy!
Search: Add faceted fields to ReviewRequestIndex and UserIndex
Review Request #15051 — Created May 13, 2026 and updated — Latest diff uploaded
Extends
ReviewRequestIndexandUserIndexwith new Elasticsearch-specific
fields required by the faceted search engine. These fields are ignored by
Whoosh.
ReviewRequestIndexgains:
-status,branch—CharField(faceted=True)for status and branch
filters and aggregations
-repository_id,submitter_id—IntegerFieldFKs for the repository
and author searchable filters
-date_created,date_updated—datetimefields 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_on—BooleanFieldfor option-count term queries
-comment_issue_statuses,file_attachment_types— multi-value fields
for issue status and file type filtersThe review-based boolean fields (
has_ship_it,has_reviews,
reviewer_user_ids) use the prefetched_public_reviewsattribute when
available duringrebuild_indexand fall back to direct DB queries during
on-the-fly indexing.has_issues_openandcommenter_user_idsalways use
direct DB queries since comment volumes can be very large.
UserIndexgains:
-is_active,is_staff—BooleanField(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_querysetnow indexes all users regardless of their
is_activestatus (theis_active=Truefilter has been removed).
Inactive users now appear in search results by default and can be filtered
out using theis_activefaceted field.A new
GroupIndexis introduced to support the groups search tab. It
indexes:
-has_open_review_requests,in_active_reviews—BooleanFieldfor
filtering groups by review request activity
-member_count—IntegerFieldfor filtering groups by membership size
-invite_only—BooleanFieldused by the permission filter to exclude
groups the searching user cannot accessA
rebuild_indexis required after upgrading to populate these new fields.
Ran full test suite.
Verified that eachnew prepare_*method onReviewRequestIndexand
UserIndexreturns the correct value, including fallback behaviour for
on-the-fly indexing when prefetches are not available. Confirmed that
index_queryseton both indexes does not introduce N+1 queries for any of the
new fields.