Skip to content

Conversation

@satyaog
Copy link
Member

@satyaog satyaog commented Jan 20, 2026

Unify flag filtering API

Refactor flag-based search to use a unified flags parameter with ~ prefix for exclusions, replacing separate include_flags/exclude_flags parameters and the deprecated validated parameter.

Changes

  • API: Replace include_flags/exclude_flags with single flags parameter (exclusions prefixed with ~)
  • Bug fix: Strip ~ prefix from exclude_flags in CLI before passing to search
  • Frontend: Convert validated parameter to flags format (valid/invalid/~valid,~invalid)
  • REST API: Add proper query parameter parsing for flags list
  • Tests: Add comprehensive test coverage for flag filtering across all collection types

use a bit more standard wording
# Test include_flags: papers must have ALL specified flags
results = sorted(collection.search(include_flags=["valid"]), key=lambda x: x.title)
assert len(results) == 3
check_papers(data_regression, results, basename=f"{tmp_path.name}_0")
Copy link
Member

Choose a reason for hiding this comment

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

Instead of a regression, could we simply check that all results have/don't have the specified flags? We could also regress on the paper titles only.

@breuleux breuleux merged commit 95b536f into mila-iqia:v3 Jan 21, 2026
1 of 2 checks passed
@satyaog satyaog deleted the fix_flag branch January 22, 2026 19:01
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