Zoekt Exclude forks and Include archived filters in the cache key
What does this MR do and why?
This code change improves a search caching system by adding support for search filters. The main updates include:
-
Added filter support: The cache now considers search filters when storing and retrieving cached search results, ensuring that different filter combinations get their own cached entries.
-
Code organization: Moved some internal methods to be private (like the
enabled?
method and attribute readers) to better encapsulate the code and make it clearer what parts are meant for external use. -
Cache key improvements: Updated how cache keys are generated to include the new filters, ensuring that searches with different filters don't accidentally share the same cached results. Also simplified some of the key generation logic.
-
Test updates: Modified the test suite to work with the new filter parameter and simplified some test cases while adding new ones to verify the cache key generation works correctly with different users and filter combinations.
The changes ensure that when users search with different filters applied, they get properly cached results specific to their filter choices, rather than potentially getting incorrect cached results from searches with different filters. This maintains search accuracy while preserving the performance benefits of caching.
References
Screenshots or screen recordings
Before | After |
---|---|
How to set up and validate locally
- Have a group with a fork project.
- Ensure this group is zoekt indexed
- Ensure Caching is enabled. https://docs.gitlab.com/integration/zoekt/#cache-search-results
- Perform a group-level code search with a term that exists in the fork project
- Select the fork filter from the side sidebar.
- Verify that the search results get updated
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 #578092