Skip to content

Conversation

@IssaAlBawwab
Copy link
Member

Summary

This PR enhances the search command with new flexible query options as discussed in #159, allowing users to pass URLs from the CERN Open Data portal directly or use more flexible query patterns and facet filtering.

Changes

New Features

  • --query option: Accepts full URLs or query strings from CERN Open Data search

    • Automatically parses query parameters, facets, pagination, and sorting
    • Example: --query "q=muon&f=experiment%3ACMS"
  • --query-pattern option: Free text search pattern

    • Provides a direct way to specify search terms
    • Example: --query-pattern "Higgs boson"
  • --query-facet option: Flexible facet filtering (repeatable)

    • Allows any key-value facet pair, not limited to predefined options
    • Can be repeated multiple times for multiple facets
    • Example: --query-facet experiment CMS --query-facet type Dataset

Implementation Details

  • Added parse_query_from_url() function in utils.py to extract parameters from URLs or query strings
  • Implemented parameter merging with proper priority:
    1. --query (if provided, extracts all parameters)
    2. --query-pattern (overrides query pattern from --query)
    3. Legacy options (--experiment, --type, --year, --category)
    4. --query-facet (adds/overrides facets)

Closes #159

@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 93.82716% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.05%. Comparing base (fc54c02) to head (2112baf).

Files with missing lines Patch % Lines
cernopendata_client/utils.py 85.71% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #162      +/-   ##
==========================================
+ Coverage   80.75%   82.05%   +1.30%     
==========================================
  Files          12       12              
  Lines         717      797      +80     
==========================================
+ Hits          579      654      +75     
- Misses        138      143       +5     
Files with missing lines Coverage Δ
cernopendata_client/cli.py 93.80% <100.00%> (+1.03%) ⬆️
cernopendata_client/searcher.py 88.00% <100.00%> (+1.63%) ⬆️
cernopendata_client/utils.py 88.88% <85.71%> (-11.12%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@IssaAlBawwab IssaAlBawwab changed the title feat: add URL parsing and flexible query options for search (#159) feat: add URL parsing and flexible query options for search Nov 21, 2025
IssaAlBawwab added a commit that referenced this pull request Nov 21, 2025
- Add parse_query_from_url() to parse URLs and query strings
- Add --query option to accept full URLs or query strings
- Add --query-pattern option for free text search
- Add --query-facet option (repeatable) for flexible facets
- Implement parameter merging with proper priority
- Make size parameter configurable in search_records().
@IssaAlBawwab IssaAlBawwab force-pushed the feature/issue-159/full_text_search branch from d8e1ccf to e2c87f5 Compare November 21, 2025 09:42
- Add parse_query_from_url() to parse URLs and query strings
- Add --query option to accept full URLs or query strings
- Add --query-pattern option for free text search
- Add --query-facet option (repeatable) for flexible facets
- Implement parameter merging with proper priority
- Make size parameter configurable in search_records().
@IssaAlBawwab IssaAlBawwab force-pushed the feature/issue-159/full_text_search branch from e2c87f5 to 2112baf Compare November 21, 2025 10:16
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.

Implement dataset listing with a selection

3 participants