Commit 6ddd51f8 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '35947-remove-feature-flag-board-search-optimization' into 'master'

Remove feature flag board_search_optimization

See merge request gitlab-org/gitlab!30623
parents 890325fd bea159ab
......@@ -20,9 +20,6 @@ module Boards
skip_before_action :authenticate_user!, only: [:index]
before_action :validate_id_list, only: [:bulk_move]
before_action :can_move_issues?, only: [:bulk_move]
before_action do
push_frontend_feature_flag(:board_search_optimization, board.group, default_enabled: true)
end
def index
list_service = Boards::Issues::ListService.new(board_parent, current_user, filter_params)
......
......@@ -12,7 +12,7 @@ module Boards
def execute
return fetch_issues.order_closed_date_desc if list&.closed?
fetch_issues.order_by_position_and_priority(with_cte: can_attempt_search_optimization?)
fetch_issues.order_by_position_and_priority(with_cte: params[:search].present?)
end
# rubocop: disable CodeReuse/ActiveRecord
......@@ -91,7 +91,7 @@ module Boards
end
def set_attempt_search_optimizations
return unless can_attempt_search_optimization?
return unless params[:search].present?
if board.group_board?
params[:attempt_group_search_optimizations] = true
......@@ -130,11 +130,6 @@ module Boards
def board_group
board.group_board? ? parent : parent.group
end
def can_attempt_search_optimization?
params[:search].present? &&
Feature.enabled?(:board_search_optimization, board_group, default_enabled: true)
end
end
end
end
......
......@@ -73,36 +73,14 @@ describe Boards::IssuesController do
end
context 'with search param' do
context 'when board_search_optimization is enabled' do
before do
stub_feature_flags(board_search_optimization: true)
end
it 'returns matching issues using optimized search' do
create(:labeled_issue, project: project_1, labels: [planning], title: 'Test Issue')
create(:labeled_issue, project: project_1, labels: [planning], title: 'Sample Issue')
list_issues user: user, board: board, list: list1, search: 'Te'
expect(response).to match_response_schema('issues')
expect(json_response['issues'].length).to eq 1
end
end
context 'when board_search_optimization is disabled' do
before do
stub_feature_flags(board_search_optimization: false)
end
it 'returns empty result' do
create(:labeled_issue, project: project_1, labels: [planning], title: 'Test Issue')
create(:labeled_issue, project: project_1, labels: [planning], title: 'Sample Issue')
it 'returns matching issues using optimized search' do
create(:labeled_issue, project: project_1, labels: [planning], title: 'Test Issue')
create(:labeled_issue, project: project_1, labels: [planning], title: 'Sample Issue')
list_issues user: user, board: board, list: list1, search: 'Te'
list_issues user: user, board: board, list: list1, search: 'Te'
expect(response).to match_response_schema('issues')
expect(json_response['issues'].length).to eq 0
end
expect(response).to match_response_schema('issues')
expect(json_response['issues'].length).to eq 1
end
end
end
......@@ -131,36 +109,14 @@ describe Boards::IssuesController do
end
context 'with search param' do
context 'when board_search_optimization is enabled' do
before do
stub_feature_flags(board_search_optimization: true)
end
it 'returns matching issues using optimized search' do
create(:issue, project: project_1, title: 'Issue XI')
create(:issue, project: project_1, title: 'Issue XX')
it 'returns matching issues using optimized search' do
create(:issue, project: project_1, title: 'Issue XI')
create(:issue, project: project_1, title: 'Issue XX')
list_issues user: user, board: board, search: 'XI'
list_issues user: user, board: board, search: 'XI'
expect(response).to match_response_schema('issues')
expect(json_response['issues'].length).to eq 1
end
end
context 'when board_search_optimization is disabled' do
before do
stub_feature_flags(board_search_optimization: false)
end
it 'returns empty result' do
create(:issue, project: project_1, title: 'Issue XI')
create(:issue, project: project_1, title: 'Issue XX')
list_issues user: user, board: board, search: 'XI'
expect(response).to match_response_schema('issues')
expect(json_response['issues'].length).to eq 0
end
expect(response).to match_response_schema('issues')
expect(json_response['issues'].length).to eq 1
end
end
end
......
......@@ -153,43 +153,18 @@ describe Boards::Issues::ListService, services: true do
end
context 'when search param is present' do
shared_examples 'returns correct result using 3 characters' do
it 'returns correct issues' do
params = { board_id: board.id, search: 'Iss' }
it 'returns correct issues' do
params = { board_id: board.id, search: 'Iss' }
issues = described_class.new(parent, user, params).execute
expect(issues).to contain_exactly(opened_issue1, opened_issue2, reopened_issue1)
end
end
context 'when board_search_optimization feature is enabled' do
before do
stub_feature_flags(board_search_optimization: true)
end
it_behaves_like 'returns correct result using 3 characters'
it 'returns correct issues using 2 characters' do
params = { board_id: board.id, search: 'Is' }
issues = described_class.new(parent, user, params).execute
expect(issues).to contain_exactly(opened_issue1, opened_issue2, reopened_issue1)
end
issues = described_class.new(parent, user, params).execute
expect(issues).to contain_exactly(opened_issue1, opened_issue2, reopened_issue1)
end
context 'when board_search_optimization feature is disabled' do
before do
stub_feature_flags(board_search_optimization: false)
end
it_behaves_like 'returns correct result using 3 characters'
it 'returns correct issues using 2 characters' do
params = { board_id: board.id, search: 'Is' }
it 'returns empty result using 2 characters' do
params = { board_id: board.id, search: 'Is' }
issues = described_class.new(parent, user, params).execute
expect(issues).to be_empty
end
issues = described_class.new(parent, user, params).execute
expect(issues).to contain_exactly(opened_issue1, opened_issue2, reopened_issue1)
end
end
end
......
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