Skip to content

fix(ui-react): search datasets by variable name against mint_standard_variables (#96) - #100

Merged
mosoriob merged 1 commit into
developfrom
fix/96-dataset-search-variable-names
Aug 9, 2026
Merged

fix(ui-react): search datasets by variable name against mint_standard_variables (#96)#100
mosoriob merged 1 commit into
developfrom
fix/96-dataset-search-variable-names

Conversation

@mosoriob

@mosoriob mosoriob commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Closes #96.

The defect

/datasets/search has a Variable names mode. It did not search variable names.

The typed term went into CKAN's free-text q. Solr answers q from title, description
and tags; it does not index mint_standard_variables, and it tokenises variable names on
_ and ~. Measured against TACC (215 packages, 33 annotated):

term before truly annotated after
groundwater 48 12 12
corpus_nlp 0 17 17

Same root cause as #94, on a different call site. #94 fixed the thread wizard
(findDatasets) and deliberately left searchDatasets alone.

The fix is not a copy of #94. The thread wizard matches an exact variable name; this
box takes a substring a person typed, so it gets its own predicate.

A second, independent fault

searchDatasets called searchPackages, whose default is rows: 100. TACC holds 215
packages, and the page treats an empty term as "list every dataset" — so it listed 100 of
215 and said nothing. Client-side matching needs the whole catalog anyway, so both modes
now go through searchAllPackages (added by #94, which pages properly).

Changes

  • packagesMatchingVariableSubstring / resourceMatchesVariableSubstring — case-insensitive
    substring match against the annotation, spanning the _ Solr would have split on. Narrows
    each kept package to the resources that carry the term, as the exact-match path already
    does; both now share one narrowToMatchingResources helper.
  • buildSearchQuery loses its variables branch. It only ever produced a query Solr cannot
    answer. Leaving it in invites the same bug back a third time.
  • DatasetQueryParameters.variables becomes variableSubstring — a bare term. The old
    *wildcard* convention was a Lit-ism that never meant anything to CKAN.
  • Dataset.variables is read off the resources rather than echoing the search term back.

Testing

  • New data-catalog-api.test.ts covering both modes, paging past the 100-row default, and
    that the variable term is never sent to CKAN as q.
  • New packagesMatchingVariableSubstring cases in ckan.test.ts.
  • All 22 new assertions were checked to fail against the pre-fix code.
  • Full suite green: 813 tests, 97 files. Typecheck and lint clean.

Verified live against ckan.tacc.utexas.edu from localhost, in the browser: the four
counts above, plus dataset-name search unchanged (carrizo → 8 genuine matches).

Note on the legacy UI

Lit's own /datasets/search is dead at TACC and this does not regress it. That page
dispatches queryGeneralDatasets, which POSTs to data_catalog_api + "/find_datasets"
(ui/src/screens/datasets/actions.ts:377) — the legacy MINT Data Catalog route. It never
goes through DataCatalogAdapter, so data_catalog_type = "CKAN" does not redirect it.
At TACC that URL answers 405, for both modes.

Scope

Client-only. No change at TACC, no Hasura metadata change. /datasets/browse and
/regions/:id/datasets are deliberately untouched — separate call sites, and ext_bbox
is already owned by #97.

🤖 Generated with Claude Code

…_variables

The "Variable names" mode of /datasets/search did not search variable
names. The typed term went into CKAN's free-text `q`, which Solr answers
from title, description and tags — it does not index
`mint_standard_variables`, and it tokenises variable names on `_` and
`~`. Against TACC this returned 48 datasets for `groundwater` where 12
carry it, and 0 for `corpus_nlp` where 17 do.

Same root cause as #94, on a different call site. The thread wizard needs
an exact variable name; this box takes a substring a person typed, so it
gets its own predicate rather than a copy.

- `packagesMatchingVariableSubstring` matches the annotation
  case-insensitively and narrows each kept package to the resources that
  carry the term, as the exact-match path already does.
- `searchDatasets` reads the whole catalog via `searchAllPackages`.
  Client-side matching needs it, and it also removes a silent cap: the
  old call took CKAN's 100-row default while TACC holds 215 packages, so
  an empty term listed 100 of them and said nothing.
- `buildSearchQuery` loses its `variables` branch. It only ever produced
  a query Solr cannot answer, and leaving it invites the same bug back.
- `Dataset.variables` is read off the resources instead of echoing the
  search term back.

Verified live against ckan.tacc.utexas.edu: groundwater 48 -> 12,
corpus_nlp 0 -> 17, empty term 100 -> 215, dataset-name search unchanged.

Closes #96
@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
monorepo Ready Ready Preview Aug 9, 2026 8:46pm

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.

1 participant