Skip to content

Refactor searchable? method to use_elasticsearch?

Terri Chu requested to merge 428070-refactor-searchable-method into master

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

  1. Setup elasticsearch in gdk
  2. Enable advanced search and elasticsearch indexing restrictions, I chose one group and project image
  3. Reindex everything from scratch: bundle exec rake gitlab:elastic:index
  4. 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"
    						}
    					}		
    				}
    	    	]
    		}
    	}
    }'
  5. Add a new project to the indexing restrictions setting and save
  6. Verify that the new project is indexed (log/elasticsearch.log)
  7. Delete a project from indexing restrictions setting and save
  8. Verify that ElasticDeleteProjectWorker is called for that project (log/sidekiq.log)
  9. Add a new group to the indexing restrictions and save
  10. Verify that the all of the namespaces' projects are indexed (log/elasticsearch.log)
  11. Delete a namespace from indexing restrictions setting and save
  12. 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.

Edited by Terri Chu

Merge request reports

Loading