Commit 26a4dc8f authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '321620-fix-project-count-only-queries' into 'master'

Advanced Search: fix project count_only queries

See merge request gitlab-org/gitlab!54303
parents 50e06870 a02bbc78
---
title: 'Advanced Search: fix project count_only queries'
merge_request: 54303
author:
type: fixed
......@@ -44,7 +44,7 @@ module Elastic
}
end
query_hash[:query][:bool][:filter] = filters
query_hash[:query][:bool][:filter] += filters
end
search(query_hash, options)
......
......@@ -1269,6 +1269,16 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
expect(projects).to include public_project
expect(results.projects_count).to eq 1
end
it 'returns 0 results for count only query' do
public_project
ensure_elasticsearch_index!
results = described_class.new(user, 'noresults')
count = results.formatted_count('projects')
expect(count).to eq('0')
end
end
context 'merge requests' do
......
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