Skip to content

CMR-10863: Granule search with json query generates all granule queries when collection identifiers are short_name, entry_title, etc. - #2536

Merged
daniel-zamora merged 1 commit into
masterfrom
CMR-10863
Nov 5, 2026
Merged

daniel-zamora merged 1 commit into
masterfrom
CMR-10863

Conversation

@daniel-zamora

@daniel-zamora daniel-zamora commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Overview

What is the objective?

Granule JSON queries treated collection identifiers (entry_title, short_name, version, provider, collection_concept_id) as plain granule conditions. As a result, they searched every granule index, or every index for a provider. URL param search resolves these to collections first and searches only those collections' indexes. This change makes JSON queries work the same way.

What are the changes?

  • JSON granule entry_title, short_name, version, provider and collection_concept_id are now collection query conditions, the same as their URL params.
    • They resolve to collection concept ids before the granule search, so only the matching collections' indexes are searched.
    • If no collection matches, the search skips Elasticsearch.
    • Identifiers at the same level merge into one collection lookup (e.g. provider + short_name).
  • collection_concept_id is validated like the URL param: malformed ids and patterns return 400.
  • Collection query resolver fix: an OR with a branch that isn't limited to collections now resolves to all collections. Before, it resolved to the ids from its other branches only.
    • Those ids wrongly narrowed later sibling lookups. For example, {"and": [{"or": [{"short_name": "S2"}, {"instrument": "i1"}]}, {"not": {"short_name": "S1"}}]} returned S1 granules.
    • URL granule search uses the same resolver, so the fix also affects URL queries that build this kind of OR (e.g. attribute with platform conditions). There it only removes the wrong narrowing.
  • Guest searches with a provider pattern or a lowercase provider now return results. Before, they returned 0 hits.
  • JSON queries with include_facets=v2 that match more than one collection now return 400, the same as URL params. This includes provider-only queries.

What areas of the application does this impact?

  • search-app: granule JSON query search, and the collection query resolver shared with URL granule search
  • system-int-test: tests only

Required Checklist

  • New and existing unit and int tests pass locally and remotely
  • clj-kondo has been run locally and all errors in changed files are corrected
  • I have commented my code, particularly in hard-to-understand areas
  • I have made changes to the documentation (if necessary)
  • My changes generate no new warnings

Additional Checklist

  • I have removed unnecessary/dead code and imports in files I have changed
  • I have cleaned up integration tests by doing one or more of the following:
    • migrated any are2 tests to are3 in files I have changed
    • de-duped, consolidated, removed dead int tests
    • transformed applicable int tests into unit tests
    • reduced number of system state resets by updating fixtures. Ex) (use-fixtures :each (ingest/reset-fixture {})) to be :once instead of :each

@codecov-commenter

codecov-commenter commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.45%. Comparing base (6cc551e) to head (3bdf84a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2536      +/-   ##
==========================================
+ Coverage   54.41%   54.45%   +0.04%     
==========================================
  Files        1047     1047              
  Lines       73542    73552      +10     
  Branches     2410     2410              
==========================================
+ Hits        40017    40055      +38     
+ Misses      31247    31221      -26     
+ Partials     2278     2276       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@daniel-zamora
daniel-zamora merged commit b84609f into master Nov 5, 2026
6 checks passed
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.

4 participants