Always pass current_user to project search results
What does this MR do and why?
Related #342648 (closed)
Discovered while rolling out the Feature Flag: search_blobs_language_aggregation
via #342621 (closed)
The feature flag only works on Global and Group level code search, but not Project level code search.
I traced the bug down to not having the current_user
passed into the objects used by project_search_results.rb
This MR:
- passes
current_user
and otherbase_options
to the ProjectSearchResults object - only check if blob aggregations should be handled when creating the Elasticsearch query, NOT reading Elasticsearch response
- refactors existing specs, including one that was passing but written poorly so it didn't catch the
🐛
Screenshots or screen recordings
N/A
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Have Elasticsearch setup for gdk
- Enable Advanced Search and have data indexed
- Enable the feature flag in the rails console
Feature.enable(:search_blobs_language_aggregation)
- perform a code search for global, group, and project level
- for each, verify using the performance bar that the Elasticsearch query contains the
aggs
section
![drawing](/-/project/278964/uploads/8e42b21d1f90426bf6cf0fee8cb9ee79/image.png)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Terri Chu