Add search filter to GLQL

What does this MR do and why?

Adds a Search field to GLQL, accepted as a filter on work items, merge requests, and projects.

Example:

type = Issue AND search = "memory leak"

It compiles to the search: GraphQL argument those three sources already accept, so there's no new codegen path. Field type is StringLike, with the = operator only.

Scope change

This MR originally also added a Code source backed by the root-level blobSearch GraphQL field. That has been removed and moved to a chained follow-up MR, per @jiaan's review and a matching suggestion in Duo's.

Reason: the filter is a small change that fits the existing sources. Code has open design questions around scope resolution, pagination, and consumer integration, and those shouldn't hold up the filter.

Every review finding on the earlier version of this MR was against the Code source. None applied to the filter. Those findings are carried over to the chained Code MR, which targets this branch.

How to set up and validate locally

  1. Check out the branch and build: cargo build
  2. Run the test suite: cargo test. The three new tests are named test_search_filter_compiles_to_the_search_argument, one each in tests/work_items_tests.rs, tests/merge_requests_tests.rs, and tests/project_tests.rs.
  3. To see the generated GraphQL for a query by hand: cargo test test_search_filter_compiles_to_the_search_argument -- --nocapture
  4. Confirm the schema document is in step with the analyzers — CI diffs it. cargo run --bin generate-schema && npm run lint:prettier:fix should leave src/schema/schema.json unchanged.
  5. To validate end-to-end against a GDK, the companion gitlab!258491 (merged) makes the Rails advanced-search finder pass a caller-supplied term to Elasticsearch instead of its hardcoded match-all. That needs elasticsearch.enabled: true in gdk.yml and a populated work item index. A GLQL block such as type = Issue and search = "memory leak" then returns only matching work items.

Known limitations

Some escaped strings don't survive the lexer or GraphQL rendering: search = "\d+\.rb", and a single-quoted value containing double quotes (search = 'foo "bar"'). Both are pre-existing lexer and rendering limitations rather than regressions from this change, but they restrict what a search term can express. Found by @jiaan; non-blocking, tracked on gitlab#631271 (closed).

Testing

One test per source asserting the search: argument is emitted. Full suite: 1904 tests pass. cargo clippy --all-targets and cargo fmt clean. src/schema/schema.json regenerated — the diff is the three new search filter entries.

Related to gitlab#631271 (closed)

🤖 Generated with Claude Code

Edited by Siddharth Dungarwal

Merge request reports

Loading
Loading