Commit a3c4361b authored by Dylan Griffith's avatar Dylan Griffith Committed by Ash McKenzie

Remove switch to basic search link

This was originally implemented as a back up because we were concerned
about the reliability of Elasticsearch. We assumed it would be safe to
add this link just in case our Elasticsearch experience was consistently
bad.

But it turned out that we forgot to ever turn the feature flag on and
our Elasticsearch has been quite robust anyway. As such we may as well
remove the feature now.

We still keep the hidden feature where the user can manually add a
`basic_search=true` to the URL to get the basic search functionality
because this is still useful for diagnostic purposes but we don't need
to provide a link to this as it's not something most people will need to
use.
parent 409d799d
......@@ -2,7 +2,6 @@
= render partial: "search/results/filters"
= render partial: "search/results/empty"
= render_if_exists 'shared/promotions/promote_advanced_search'
= render_if_exists 'search/form_revert_to_basic'
- else
.row-content-block.d-md-flex.text-left.align-items-center
- unless @search_objects.is_a?(Kaminari::PaginatableWithoutCount)
......
......@@ -60,23 +60,6 @@ module EE
Truncato.truncate(search_highlight[issue.id].description.first, count_tags: false, count_tail: false, max_length: 200).html_safe
end
def revert_to_basic_search_filter_url
search_params = params
.permit(::SearchHelper::SEARCH_PERMITTED_PARAMS)
.merge(basic_search: true)
search_path(search_params)
end
def show_switch_to_basic_search?(search_service)
return false unless ::Feature.enabled?(:switch_to_basic_search, default_enabled: false)
return false unless search_service.use_elasticsearch?
return true if @project
search_service.scope.in?(SWITCH_TO_BASIC_SEARCHABLE_TABS)
end
private
def search_multiple_assignees?(type)
......
- if show_switch_to_basic_search?(search_service)
- begin_link = '<a href="%{url}">'.html_safe % { url: revert_to_basic_search_filter_url }
- end_link = '</a>'.html_safe
%p.text-center
= _('You can try again using %{begin_link}basic search%{end_link}').html_safe % { begin_link: begin_link, end_link: end_link }
---
name: switch_to_basic_search
introduced_by_url:
rollout_issue_url:
group:
type: development
default_enabled: false
......@@ -230,39 +230,6 @@ RSpec.describe 'Global elastic search', :elastic, :sidekiq_inline do
expect(page).to have_content('Users 0')
end
end
context 'when no results are returned' do
it 'allows basic search without Elasticsearch' do
visit dashboard_projects_path
# Disable sidekiq to ensure it does not end up in the index
Sidekiq::Testing.disable! do
create(:project, namespace: user.namespace, name: 'Will not be found but searchable')
end
submit_search('searchable')
expect(page).not_to have_content('Will not be found')
# Since there are no results you have the option to instead use basic
# search
click_link 'basic search'
# Project is found now that we are using basic search
expect(page).to have_content('Will not be found')
end
context 'when performing Commits search' do
it 'does not allow basic search' do
visit dashboard_projects_path
submit_search('project')
select_search_scope('Commits')
expect(page).not_to have_link('basic search')
end
end
end
end
RSpec.describe 'Global elastic search redactions', :elastic do
......
......@@ -121,48 +121,4 @@ RSpec.describe SearchHelper do
it_behaves_like 'returns old message'
end
end
describe '#show_switch_to_basic_search?' do
let(:use_elasticsearch) { true }
let(:scope) { 'commits' }
let(:search_service) { instance_double(Search::GlobalService, use_elasticsearch?: use_elasticsearch, scope: scope) }
subject { show_switch_to_basic_search?(search_service) }
before do
stub_feature_flags(switch_to_basic_search: true)
end
context 'when :switch_to_basic_search feature is disabled' do
before do
stub_feature_flags(switch_to_basic_search: false)
end
it { is_expected.to eq(false) }
end
context 'when not currently using elasticsearch' do
let(:use_elasticsearch) { false }
it { is_expected.to eq(false) }
end
context 'when project scope' do
before do
@project = create(:project)
end
it { is_expected.to eq(true) }
end
context 'when commits tab' do
it { is_expected.to eq(false) }
end
context 'when issues tab' do
let(:scope) { 'issues' }
it { is_expected.to eq(true) }
end
end
end
......@@ -29195,9 +29195,6 @@ msgstr ""
msgid "You can test your .gitlab-ci.yml in %{linkStart}CI Lint%{linkEnd}."
msgstr ""
msgid "You can try again using %{begin_link}basic search%{end_link}"
msgstr ""
msgid "You cannot access the raw file. Please wait a minute."
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment