Zoekt: Query syntax transpiler
What does this MR do and why?
This code change adds support for tracking where search requests come from (API vs web interface) and improves search functionality for API users.
The main changes include:
- Adding a "caller" parameter throughout the search system to identify whether searches come from the API or web interface
- Modifying the search query formatting to handle different syntax filters differently based on the caller - API users get more advanced filter options that are automatically converted to the proper search syntax
- Changing the default search behavior for API users to use regex mode instead of exact match mode, making searches more flexible
- Updating the query processing to support advanced filters like "extension:", "filename:", and "path:" that get translated into the appropriate search engine syntax
- Adding comprehensive tests to verify that the new functionality works correctly for both API and web users
The overall goal is to provide a better search experience for API users while maintaining backward compatibility for web users, with the system automatically handling the technical differences in how searches should be processed based on where they originate.
References
Screenshots or screen recordings
| Advanced | Exact |
|---|---|
![]() |
![]() |
How to set up and validate locally
- In one incognito window, log in as a different user and disable exact code search. And in one window, keep exact code search enabled.
- Run some tests in both windows and see if the results are relevant.
Change the
project_id: 29,group_id: 22to yours. - https://gdk.test:3443/api/v4/projects/29/search?scope=blobs&search=zoekt%20extension:md
- https://gdk.test:3443/api/v4/projects/29/search?scope=blobs&search=zoekt%20filename:indexer
- https://gdk.test:3443/api/v4/projects/29/search?scope=blobs&search=zoekt%20path:controllers
- https://gdk.test:3443/api/v4/projects/29/search?scope=blobs&search=zoekt%20-path:controllers
- https://gdk.test:3443/api/v4/groups/22/search?scope=blobs&search=test%20path:maven
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #537019 (closed)
Edited by Ravi Kumar

