Skip to content

feat(search): split ADS compat collection filter into pills - #937

Open
thostetler wants to merge 2 commits into
adsabs:masterfrom
thostetler:feature/ads-compat-collection-pills-master
Open

thostetler wants to merge 2 commits into
adsabs:masterfrom
thostetler:feature/ads-compat-collection-pills-master

Conversation

@thostetler

@thostetler thostetler commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

In ADS compat mode the OR-joined database filter showed as a single pill, so removing it dropped every collection at once, and removing a collection could get silently reapplied on the next search. This ports the fix that shipped as v0.50.2-hotfix-1 to master.

  • Split OR-joined collection filters into one removable pill per collection, labeled "collection"
  • Gate compat defaults and the compat-to-normal strip on the ads_compat marker instead of filter shape, so removed collections stay removed and normal-mode Collections picks aren't wiped
  • Replace rather than AND-join the settings database filter when entering compat mode
  • Normalize single fq values to arrays before filtering/appending
  • Widen filter pill max width from 200px to 400px
  • Remove searchMode's import of query-utils (inlined the one setFQ call, moved safeGetArray to a leaf module) so it stops pulling zod and friends into the landing page, classic form, and abstract routes; first-load JS on those routes drops back to baseline

@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Bundle size

Shared by all pages: 629.5 kB (-0.1 kB) ⚪

Route Base Head Change
/classic-form 707.1 kB 705.1 kB -2.0 kB 🟢
/user/libraries/[[...id]] 1070.1 kB 1068.9 kB -1.2 kB 🟢
/search/citation_helper 1073.0 kB 1071.8 kB -1.2 kB 🟢
/public-libraries/[[...id]] 1070.0 kB 1068.8 kB -1.2 kB 🟢

First load = polyfills + shared _app chunks + route chunks, gzipped.

@codecov

codecov Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.1%. Comparing base (ef57c7e) to head (ff0b37e).

Files with missing lines Patch % Lines
src/query-utils.ts 77.8% 1 Missing and 3 partials ⚠️
src/utils/common/searchMode.ts 89.5% 1 Missing and 1 partial ⚠️
src/components/SearchFacet/FacetFilters.tsx 88.9% 1 Missing ⚠️
src/components/SearchFacet/helpers.ts 96.9% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #937     +/-   ##
========================================
+ Coverage    55.0%   55.1%   +0.2%     
========================================
  Files         374     377      +3     
  Lines       11462   11605    +143     
  Branches     2514    2545     +31     
========================================
+ Hits         6303    6394     +91     
- Misses       4527    4573     +46     
- Partials      632     638      +6     
Files with missing lines Coverage Δ
src/utils/common/to-array.ts 100.0% <100.0%> (ø)
src/components/SearchFacet/FacetFilters.tsx 56.0% <88.9%> (ø)
src/components/SearchFacet/helpers.ts 73.7% <96.9%> (+10.1%) ⬆️
src/utils/common/searchMode.ts 93.8% <89.5%> (-0.3%) ⬇️
src/query-utils.ts 78.5% <77.8%> (-0.2%) ⬇️

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thostetler
thostetler marked this pull request as ready for review September 28, 2026 21:16
Copilot AI lite review requested due to automatic review settings September 28, 2026 21:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@thostetler
thostetler force-pushed the feature/ads-compat-collection-pills-master branch from af7ed35 to 9a984e6 Compare September 29, 2026 20:11
In ADS compat mode the OR-joined fq_database filter rendered as one pill
for "astronomy OR physics", so removing it dropped both collections at
once. It now splits into one removable pill per collection, joined by a
small OR chip, and the pill is labeled "collection" instead of "database".
AND-joined groups keep the single combined pill.

- Add removeFQTerm to drop a single term from an AND-group inside an fq
  value, instead of only removing the whole group, and parenthesize every
  group it rebuilds — getClauses only recognizes a parenthesized group, so
  an unwrapped one parses back to nothing and its pills disappear while the
  filter stays applied
- Gate the compat collection defaults on ads_compat=1 rather than on
  fq_database being unset, so a collection the user removed isn't
  reapplied on the next search, and clearing every collection sticks
- Replace a settings-derived database filter when entering compat mode
  instead of AND-joining onto it, which produced empty result sets
- Gate the compat-to-normal strip on ads_compat=1 still being present;
  it previously matched on filter shape alone and could wipe a
  normal-mode user's Collections facet pick, since astronomy/physics are
  valid choices there too
- Match compat filters regardless of term quoting, so the shape Classic
  Form produces is recognized and stripped like the default one
- Normalize a single fq value to an array before filtering or appending
  to it — it round-trips through the URL as a bare string, and ramda's
  array ops were silently spreading it into one element per character
- Widen the filter pill max width from 200px to 400px so longer labels
  like "collection: earthscience AND general" aren't clipped
setFQ pulled in query-utils' zod/store/api graph via searchMode.ts,
adding it to the landing page, ClassicForm, and abs bundles. Extract
safeGetArray into an import-free leaf module and inline the one
setFQ call searchMode.ts needs as setDatabaseFQ, so the module no
longer imports query-utils at all.
@thostetler
thostetler force-pushed the feature/ads-compat-collection-pills-master branch from 9a984e6 to ff0b37e Compare September 30, 2026 02:32

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants