Refactor searchable? method to use_elasticsearch?
What does this MR do and why?
Related to #428070 (closed)
A smaller iteration to allow all projects to be indexed (eventually)
This MR refactors the searchable?
method and replaces it with the method it calls use_elasticsearch?
. This refactor reduces complexity in how a project is defined as "being indexed". As part of the refactor, I had to update a few specs.
Screenshots or screen recordings
No UI changes
How to set up and validate locally
- Setup elasticsearch in gdk
- Enable advanced search and elasticsearch indexing restrictions, I chose one group and project
- Reindex everything from scratch:
bundle exec rake gitlab:elastic:index
- Verify that only the expected projects exist in the index, in my case that is 3 projects (2 under the selected group, and 1 selected project)
curl --request GET \ --url http://localhost:9200/gitlab-development-projects/_search \ --data '{ "query": { "bool": { "must": [ { "term": { "type": { "value": "project" } } } ] } } }'
- Add a new project to the indexing restrictions setting and save
- Verify that the new project is indexed (
log/elasticsearch.log
) - Delete a project from indexing restrictions setting and save
- Verify that
ElasticDeleteProjectWorker
is called for that project (log/sidekiq.log
) - Add a new group to the indexing restrictions and save
- Verify that the all of the namespaces' projects are indexed (
log/elasticsearch.log
) - Delete a namespace from indexing restrictions setting and save
- Verify that
ElasticDeleteProjectWorker
is called for all of the namespaces' project (log/sidekiq.log
)
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