Fix Search API project scope
What does this MR do and why?
This MR fixes NoMethodError: undefined method '+' for nil:NilClass
when using search API with projects scope and empty search term. It turned out that the problem is in Elastic::Latest::ProjectClassProxy
.
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
- Enable Advanced Search if it's not configured
- Checkout the
master
branch - Execute this command in rails console:
Search::GlobalService.new(nil, { scope: 'projects', search: '' }).execute.objects('projects')
- Ensure that it fails with the
NoMethodError
exception - Checkout this MR's branch
git checkout 347238-fix-api-project-search
- Execute the same command in rails console:
Search::GlobalService.new(nil, { scope: 'projects', search: '' }).execute.objects('projects')
- This time it should return results
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.
Related to #347238 (closed)
Edited by Dmitry Gruzd