Commit e72964c7 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'es_search_though_the_project_description' into 'master'

Elasticsearch searches through the project description

Closes #2367

See merge request !1899
parents 97f17efa 3a268fb7
......@@ -72,7 +72,7 @@ module Elastic
end
def self.elastic_search(query, options: {})
options[:in] = %w(name^10 name_with_namespace^2 path_with_namespace path^9)
options[:in] = %w(name^10 name_with_namespace^2 path_with_namespace path^9 description)
query_hash = basic_query_hash(options[:in], query)
......
---
title: Elasticsearch searches through the project description
merge_request:
author:
......@@ -16,7 +16,7 @@ describe Project, elastic: true do
Sidekiq::Testing.inline! do
project = create :empty_project, name: 'test1'
project1 = create :empty_project, path: 'test2'
project1 = create :empty_project, path: 'test2', description: 'awesome project'
project2 = create :empty_project
create :empty_project, path: 'someone_elses_project'
project_ids += [project.id, project1.id, project2.id]
......@@ -26,6 +26,7 @@ describe Project, elastic: true do
expect(described_class.elastic_search('test1', options: { project_ids: project_ids }).total_count).to eq(1)
expect(described_class.elastic_search('test2', options: { project_ids: project_ids }).total_count).to eq(1)
expect(described_class.elastic_search('awesome', options: { project_ids: project_ids }).total_count).to eq(1)
expect(described_class.elastic_search('test*', options: { project_ids: project_ids }).total_count).to eq(2)
expect(described_class.elastic_search('someone_elses_project', options: { project_ids: project_ids }).total_count).to eq(0)
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