Skip to content

Fix multi fq breaking is_archived filter (follow-up) - #296

Open
Gutts-n wants to merge 1 commit into
mainfrom
fix/package-search-multi-fq-archived-v2
Open

Fix multi fq breaking is_archived filter (follow-up)#296
Gutts-n wants to merge 1 commit into
mainfrom
fix/package-search-multi-fq-archived-v2

Conversation

@Gutts-n

@Gutts-n Gutts-n commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

What changed

Follow-up to PR #295 (merged, commit 79f02ac). That PR fixed the crash where combining multiple fq params corrupted the query, but the fix itself was incomplete.

_control_archived_datasets_visibility in ckanext/tdc/logic/action.py was changed to append "-is_archived:(true)" as a new list element when fq arrives as a list. That stopped the Python-level corruption, but CKAN core (ckan/lib/search/query.py) does fq.append(query['fq']) when building the Solr query - it treats whatever is in data_dict['fq'] as a single opaque clause, not something to iterate. So a list fq still broke, just differently: Solr received the list's Python repr as one clause, e.g.

+capacity:public ["organization:tumi", "geographies:ken", "-is_archived:(true)"]

which Solr rejected with the same class of parse error as before.

CKAN's package_search action itself documents fq as type string (multi-filter is meant to go through the separate fq_list param). So the correct fix is to normalize fq to a string, not a list.

Fix

When fq arrives as a list, join it into a space-separated string before appending the archived filter, so data_dict['fq'] is always a plain string by the time core sees it - matching what core actually expects.

Verified

  • Confirmed against the live staging environment (ckan.transport-data.org / dx-helm-tdc-staging) using the original repro (fq=organization:tumi&fq=geographies:ken) by temporarily pinning the staging build to this fix's commit.
  • Traced the failure through ckan/lib/search/query.py and ckan/logic/action/get.py (package_search) to confirm core expects a string, not a list.
  • NOT verified: no automated test exists for this function (no active Python test suite in CI for ckanext-tdc, only Cypress frontend/E2E). Did not add one here either.

Deployment

No deploy-on-merge workflow found in this repo's .github/workflows/. Staging's CKANEXT_TDC_HASH in ckan/Dockerfile was temporarily bumped for testing during this investigation and has since been reset - this PR does not touch that pin, so merging it won't move the deployed hash on its own.

@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
tdc-data-portal Ignored Ignored Aug 19, 2026 8:04pm

Request Review

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