Commit bc150577 authored by Dmitry Gruzd's avatar Dmitry Gruzd

Merge branch '347238-fix-api-project-search' into 'master'

Fix Search API project scope

See merge request gitlab-org/gitlab!76360
parents 83e70c2f ced62c5f
......@@ -44,6 +44,7 @@ module Elastic
}
end
query_hash[:query][:bool][:filter] ||= []
query_hash[:query][:bool][:filter] += filters
end
......
......@@ -24,6 +24,16 @@ RSpec.describe Search::GlobalService do
it_behaves_like 'search query applies joins based on migrations shared examples', :add_new_data_to_merge_requests_documents
end
context 'when projects search has an empty search term', :elastic do
subject { service.execute.objects('projects') }
let(:service) { described_class.new(nil, search: nil) }
it 'does not raise exception' do
is_expected.to be_empty
end
end
context 'visibility', :elastic_delete_by_query, :clean_gitlab_redis_shared_state, :sidekiq_inline do
include_context 'ProjectPolicyTable context'
......
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