Search: Add faceted search view routing and templates
Review Request #15054 — Created May 13, 2026 and updated — Latest diff uploaded
Updates
RBSearchViewand adds the templates, CSS, and datagrid
infrastructure for the new faceted search results page.
RBSearchView.dispatchnow checks whether the active backend exposes
get_es_client. If it does, aFacetedSearchEngineis constructed and
_use_facetedis set toTrue. Any exception during construction falls
back silently to the existing Haystack path. Numeric queries still
redirect directly to the matching review request when accessible.
get_template_namesreturnssearch/results.htmlfor the faceted path
andsearch/results_legacy.htmlfor the Haystack path.
get_context_dataon the faceted path calls
FacetedSearchEngine.search, builds the group sidebar items with total
counts, resolves human-readable labels for searchable filter buckets
(reviewer, group, repository), and assembles the filter panel context
including current values, bucket lists, and option counts.Search results are displayed using Review Board's existing datagrid
infrastructure. Three new datagrid classes are added:
SearchReviewRequestDataGrid,SearchUsersDataGrid, and
SearchGroupDataGrid. Each takes an ES-ordered PK list and an ES total
count, builds aCase/When-ordered ORM queryset from those PKs, and
overrides pagination to use the ES total rather than aCOUNT(*). Letter
navigation for users and groups is handled server-side by injecting a
prefixorregexpfilter clause directly into the ES query, avoiding
any full result fetch regardless of dataset size.
results.htmlis the new template for the faceted path, providing the
filter sidebar and results list.results_legacy.htmlis the existing
template renamed, unchanged in behaviour. search_listview.html and
search_paginator.htmlare new search-specific datagrid templates.
search.lessadds styles for the filter sidebar, bucket counts, active
filter indicators, and the Contents filter checkbox group.
_comment.htmland_group.htmlare new partial templates for
rendering comment and group search results inline.
Ran full test suite.
Verified thatdispatchcorrectly routes to the faceted path when
Elasticsearch is available and falls back silently to the Haystack
path when it is not or when engine construction fails.Verified template selection, user attachment on search hits, numeric
query redirection, and Whoosh wildcard rewriting.Confirmed the existing Haystack path is unaffected.
Verified that review request, user, and group results all display
correctly in their respective datagrids with correct column data and
ES-ordered rows.Verified that letter navigation on the users and groups tabs filters
correctly server-side via ES prefix/regexp queries and that the active
letter is correctly highlighted after navigation.Verified that pagination reflects ES total counts rather than ORM
counts across all three result tabs.Confirmed correct behaviour when switching between result tabs,
applying sidebar filters, and navigating pages.