Remove hack to set index_name for wikis
What does this MR do and why?
We were setting the index_name in git_class_proxy for separate_wiki_index
options[:index_name] = Elastic::Latest::WikiConfig.index_name
which is not so clean. That's why added a method use_separate_indices? in the ProjectWiki class which is similar to other classes like User, and MergeRequest. Without this method for wiki search, it was not selecting the Config instead of WikiConfig.
Done the refactoring in the proxy_util. Use the "#{target.base_class}Config". Add the base_class method in the model Wiki to return Wiki. This is guarded by a feature_flag use_base_class_in_proxy_util
For eg: in the case of ApplicationRecord like User, User.base_class will be User. In the case of non-ApplicationRecord like ProjectWiki, ProjectWiki.base_class will be Wiki.
The second change not related to the main change is that I have removed the feature.eql?('wiki') check from the method use_separate_wiki_index?. This method was returning false if the feature was not wiki. At the method calling place, I find this more readable options[:feature].eql?('wiki') && use_separate_wiki_index?
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.