Zoekt search returns 400 http status code for some searches
What does this MR do and why?
This merge request adds a new "regex" search option to GitLab's code search functionality. The changes update the API documentation to include this new parameter that allows users to perform regular expression searches when doing exact code searches. The update also removes one test file from a code quality exclusion list and fixes some formatting issues in the API specification files. Additionally, the documentation clarifies that when the "exclude_forks" and "regex" options aren't explicitly set, the system will exclude forked projects and use regular expressions by default. A note was added warning users that Elasticsearch search syntax may not work properly with exact code search and recommends using regular expressions instead.
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Run GDK as
ce: https://docs.gitlab.com/development/ee_features/#simulate-a-ce-instance-with-a-licensed-gdk - Perform a code search with a regex query param. Eg:
https://gdk.test:3443/api/v4/projects/7/search?search=qwerty&scope=blobs®ex=true - You must get a bad request error
{"message":{"error":"regex option is not available"}} - Run GDK as
ee: https://docs.gitlab.com/development/ee_features/#simulate-a-ce-instance-with-a-licensed-gdk - Enable zoekt and perform a project-level, group-level, and global search for
scope=blobson a project(or group) for which zoekt is set up. - Pass
regex=trueandregex=false, verify that the search results respect the supplied search mode. - Disable zoekt from admin settings and pass
regexquery parameters. Now you should get a bad request{"message":{"error":"regex supported only with exact code search"}}.
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 #521686 (closed)