Default search rankings to Relevance for bills and testimonies - #2241
Open
fastfadingviolets wants to merge 2 commits into
Open
fastfadingviolets wants to merge 2 commits into
fastfadingviolets wants to merge 2 commits into
Conversation
The default was "Sort by Most Recent Testimony", a pure recency sort in which text relevance plays no part. A query like "liquor" expands through the legislative synonym set to "alcohol" and matches hundreds of bills in their full text, and under that sort the page led with whichever weak body-text match had the newest testimony: the budget, a tax-cap bill, a tenant bill. Relevance is now the first option and the default. Its index name is the bare "bills" collection rather than "bills/sort/<sort_by>", and BillSearch pins billsRelevanceSort as the adapter's sort_by: the adapter falls back to that whenever the index name has no sort segment. That keeps the _eval clause out of every Browse Bills URL, which is keyed by index name, so a default page reads bills[query]=liquor. The other options keep their sort in the index name and override the pinned one as before. The eval-shared billsSearchParams is unchanged, so the harness sends exactly what it did. The default index name lives next to the sort options, and BillSearch and billSearchByTopicLink both key on it instead of a hard-coded string; the topic links previously carried the old latestTestimonyAt key and would otherwise have landed on the page with no refinements. billsRelevanceSort itself is unchanged and the bills golden set scores byte-identical to the bills-order-demotion baseline. The empty-query landing page now orders non-procedural bills by testimony count, the sort's tiebreaker. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QeZFi8CjMyJixcm5CbGUzq
Same change as for bills, same mechanism. Relevance is the first option and the default, keyed on the bare "publishedTestimony" collection with testimonyRelevanceSort pinned as the adapter's sort_by, so the sort string stays out of the page's URLs. Newest and Oldest keep their sort in the index name and override it as before. The landing page does not change: with no query every document's text match is equal, so the relevance sort falls through to its publishedAt tiebreak and reads newest-first exactly as the old default did. With a query, weak matches no longer win on date alone. Hearings keep their date-windowed default, since "past, newest first" is a view with a time filter rather than a sort. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QeZFi8CjMyJixcm5CbGUzq
fastfadingviolets
requested review from
Mephistic,
alexjball,
kiminkim724,
mertbagt,
mvictor55,
nesanders,
sashamaryl and
timblais
as code owners
September 10, 2026 21:24
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
"Sort by relevance" used to be undefined & a TypeScript default, but ever since #2227, it's actually defined for bills, hearings, and testimonies. It weighs based on the score of the hit & then tiebreaks by recency for testimonies & recency of last testimony for bills. This switches the default ordering to be relevance for testimonies & bills (hearings are untouched as a chronological sort makes more sense for hearings).
Checklist
firestore.indexes.json(Please do not only create indexes through the Firebase Web UI, even though the error messages may reccommend it - indexes created this way may be obliterated by subsequent deploys)Screenshots
Known issues
If you've run against limitations or caveats, include them here. Include follow-up issues as well.
Steps to test/reproduce
For each feature or bug fix, create a step by step list for how a reviewer can test it out. E.g.: