Commit ced62c5f authored by Dmitry Gruzd's avatar Dmitry Gruzd

Fix Search API project scope

parent ce272f6b
...@@ -44,6 +44,7 @@ module Elastic ...@@ -44,6 +44,7 @@ module Elastic
} }
end end
query_hash[:query][:bool][:filter] ||= []
query_hash[:query][:bool][:filter] += filters query_hash[:query][:bool][:filter] += filters
end end
......
...@@ -24,6 +24,16 @@ RSpec.describe Search::GlobalService do ...@@ -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 it_behaves_like 'search query applies joins based on migrations shared examples', :add_new_data_to_merge_requests_documents
end 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 context 'visibility', :elastic_delete_by_query, :clean_gitlab_redis_shared_state, :sidekiq_inline do
include_context 'ProjectPolicyTable context' 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