Update order of zoekt query conditions
What does this MR do and why?
Moves evaluation of access branches at the very bottom of zoekt queries.
AI Summary
This change optimizes the performance of code search queries by reordering how search filters are applied. Previously, expensive access permission checks (which determine what code branches a user can see) were processed early in the query. Now these permission filters are moved to the very end of the query processing, allowing cheaper filters like "exclude archived projects" to run first and reduce the dataset before the expensive permission checks are applied.
The change also improves the structure of the search query by adding better context labels to help with debugging and monitoring. All the test files were updated to reflect this new ordering - you can see that filters for things like "archived" and "project_id" now appear before the "access_branches" permission filters in the generated search queries.
This is a performance optimization that should make code searches faster, especially for users with complex permission setups, without changing what results they see.
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
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.