Commit 504608d1 authored by Ian Baum's avatar Ian Baum

Resolving conflict with lib/api/search.rb

parent 2df798a7
...@@ -18,11 +18,8 @@ module API ...@@ -18,11 +18,8 @@ module API
snippet_blobs: Entities::Snippet snippet_blobs: Entities::Snippet
}.freeze }.freeze
<<<<<<< HEAD
ELASTICSEARCH_SCOPES = %w(wiki_blobs blobs commits).freeze ELASTICSEARCH_SCOPES = %w(wiki_blobs blobs commits).freeze
=======
>>>>>>> upstream/master
def search(additional_params = {}) def search(additional_params = {})
search_params = { search_params = {
scope: params[:scope], scope: params[:scope],
...@@ -38,15 +35,12 @@ module API ...@@ -38,15 +35,12 @@ module API
end end
def process_results(results) def process_results(results)
<<<<<<< HEAD
return [] if results.empty? return [] if results.empty?
if results.is_a?(Elasticsearch::Model::Response::Response) if results.is_a?(Elasticsearch::Model::Response::Response)
return paginate(results).map { |blob| Gitlab::Elastic::SearchResults.parse_search_result(blob) } return paginate(results).map { |blob| Gitlab::Elastic::SearchResults.parse_search_result(blob) }
end end
=======
>>>>>>> upstream/master
case params[:scope] case params[:scope]
when 'wiki_blobs' when 'wiki_blobs'
paginate(results).map { |blob| Gitlab::ProjectSearchResults.parse_search_result(blob) } paginate(results).map { |blob| Gitlab::ProjectSearchResults.parse_search_result(blob) }
...@@ -64,7 +58,6 @@ module API ...@@ -64,7 +58,6 @@ module API
def entity def entity
SCOPE_ENTITY[params[:scope].to_sym] SCOPE_ENTITY[params[:scope].to_sym]
end end
<<<<<<< HEAD
def check_elasticsearch_scope! def check_elasticsearch_scope!
if ELASTICSEARCH_SCOPES.include?(params[:scope]) && !elasticsearch? if ELASTICSEARCH_SCOPES.include?(params[:scope]) && !elasticsearch?
...@@ -75,8 +68,6 @@ module API ...@@ -75,8 +68,6 @@ module API
def elasticsearch? def elasticsearch?
Gitlab::CurrentSettings.elasticsearch_search? Gitlab::CurrentSettings.elasticsearch_search?
end end
=======
>>>>>>> upstream/master
end end
resource :search do resource :search do
...@@ -88,7 +79,6 @@ module API ...@@ -88,7 +79,6 @@ module API
requires :scope, requires :scope,
type: String, type: String,
desc: 'The scope of search, available scopes: desc: 'The scope of search, available scopes:
<<<<<<< HEAD
projects, issues, merge_requests, milestones, snippet_titles, snippet_blobs, projects, issues, merge_requests, milestones, snippet_titles, snippet_blobs,
if Elasticsearch enabled: wiki_blobs, blobs, commits', if Elasticsearch enabled: wiki_blobs, blobs, commits',
values: %w(projects issues merge_requests milestones snippet_titles snippet_blobs values: %w(projects issues merge_requests milestones snippet_titles snippet_blobs
...@@ -98,13 +88,6 @@ module API ...@@ -98,13 +88,6 @@ module API
get do get do
check_elasticsearch_scope! check_elasticsearch_scope!
=======
projects, issues, merge_requests, milestones, snippet_titles, snippet_blobs',
values: %w(projects issues merge_requests milestones snippet_titles snippet_blobs)
use :pagination
end
get do
>>>>>>> upstream/master
present search, with: entity present search, with: entity
end end
end end
...@@ -119,7 +102,6 @@ module API ...@@ -119,7 +102,6 @@ module API
requires :scope, requires :scope,
type: String, type: String,
desc: 'The scope of search, available scopes: desc: 'The scope of search, available scopes:
<<<<<<< HEAD
projects, issues, merge_requests, milestones, projects, issues, merge_requests, milestones,
if Elasticsearch enabled: wiki_blobs, blobs, commits', if Elasticsearch enabled: wiki_blobs, blobs, commits',
values: %w(projects issues merge_requests milestones wiki_blobs blobs commits) values: %w(projects issues merge_requests milestones wiki_blobs blobs commits)
...@@ -127,13 +109,6 @@ module API ...@@ -127,13 +109,6 @@ module API
end end
get ':id/-/search' do get ':id/-/search' do
check_elasticsearch_scope! check_elasticsearch_scope!
=======
projects, issues, merge_requests, milestones',
values: %w(projects issues merge_requests milestones)
use :pagination
end
get ':id/-/search' do
>>>>>>> upstream/master
find_group!(params[:id]) find_group!(params[:id])
present search(group_id: params[:id]), with: entity present search(group_id: params[:id]), with: entity
......
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