Only use Elasticsearch if all projects in search scope have been initially indexed
What does this MR do?
This is step 1 for #33681 (closed) .
Then the main change in this MR introduces is to check whether or not all projects have been indexed once before using Elasticsearch for searches. If we've not gotten to all the projects yet in a group then we don't want to use Elasticsearch yet and hence we fallback to the basic Postgres/Gitaly search. When searching in the context of a single project then we also check that this project has been indexed before using Elasticsearch so it is not just applying to groups.
This is an important step in #33681 (closed) because we will start rolling out Elasticsearch to hundreds/thousands of groups at a time and the queue may get quite long and some projects might take a while before indexing kicks off and we don't want people missing search results for a long time.
This MR also introduces 2 small refactorings:
- Add some missing
override
to existing methods - Extract
Project#find_or_create_index_status!
so that we don't need to ignore rubocopCodeReuse
warning
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team