Skip to content
Snippets Groups Projects
Commit f0b4a6a9 authored by Valery Sizov's avatar Valery Sizov
Browse files

Update elastic to 5.1

parent d64e11e0
No related branches found
No related tags found
1 merge request!24Update elastic to 5.1
Pipeline #
Loading
Loading
@@ -21,55 +21,52 @@ module Elasticsearch
include Elasticsearch::Git::Model
include Elasticsearch::Git::EncoderHelper
 
mapping _timestamp: { enabled: true }, _parent: { type: 'project' } do
mapping _parent: { type: 'project' } do
indexes :blob do
indexes :id, type: :string,
indexes :id, type: :text,
index_options: 'offsets',
analyzer: :sha_analyzer
indexes :rid, type: :string,
index: :not_analyzed
indexes :oid, type: :string,
indexes :rid, type: :keyword
indexes :oid, type: :text,
index_options: 'offsets',
analyzer: :sha_analyzer
indexes :commit_sha, type: :string,
indexes :commit_sha, type: :text,
index_options: 'offsets',
analyzer: :sha_analyzer
indexes :path, type: :string,
indexes :path, type: :text,
analyzer: :path_analyzer
indexes :file_name, type: :string,
indexes :file_name, type: :text,
analyzer: :code_analyzer,
search_analyzer: :code_search_analyzer
indexes :content, type: :string,
indexes :content, type: :text,
index_options: 'offsets',
analyzer: :code_analyzer,
search_analyzer: :code_search_analyzer
indexes :language, type: :string,
index: :not_analyzed
indexes :language, type: :keyword
end
 
indexes :commit do
indexes :id, type: :string,
indexes :id, type: :text,
index_options: 'offsets',
analyzer: :sha_analyzer
indexes :rid, type: :string,
index: :not_analyzed
indexes :sha, type: :string,
indexes :rid, type: :keyword
indexes :sha, type: :text,
index_options: 'offsets',
analyzer: :sha_analyzer
 
indexes :author do
indexes :name, type: :string, index_options: 'offsets'
indexes :email, type: :string, index_options: 'offsets'
indexes :name, type: :text, index_options: 'offsets'
indexes :email, type: :text, index_options: 'offsets'
indexes :time, type: :date, format: :basic_date_time_no_millis
end
 
indexes :commiter do
indexes :name, type: :string, index_options: 'offsets'
indexes :email, type: :string, index_options: 'offsets'
indexes :name, type: :text, index_options: 'offsets'
indexes :email, type: :text, index_options: 'offsets'
indexes :time, type: :date, format: :basic_date_time_no_millis
end
 
indexes :message, type: :string, index_options: 'offsets'
indexes :message, type: :text, index_options: 'offsets'
end
end
 
Loading
Loading
@@ -465,16 +462,7 @@ module Elasticsearch
 
options[:order] = :default if options[:order].blank?
 
order = case options[:order].to_sym
when :recently_indexed
{ _timestamp: { order: :desc, mode: :min } }
when :last_indexed
{ _timestamp: { order: :asc, mode: :min } }
else
{}
end
query_hash[:sort] = order.blank? ? [:_score] : [order, :_score]
query_hash[:sort] = [:_score]
 
res = self.__elasticsearch__.search(query_hash)
{
Loading
Loading
@@ -527,26 +515,16 @@ module Elasticsearch
 
options[:order] = :default if options[:order].blank?
 
order = case options[:order].to_sym
when :recently_indexed
{ _timestamp: { order: :desc, mode: :min } }
when :last_indexed
{ _timestamp: { order: :asc, mode: :min } }
else
{}
end
query_hash[:sort] = order.blank? ? [:_score] : [order, :_score]
query_hash[:sort] = [:_score]
 
if options[:highlight]
query_hash[:highlight] = {
pre_tags: ["gitlabelasticsearch→"],
post_tags: ["←gitlabelasticsearch"],
order: "score",
fields: {
"blob.content" => {},
"blob.file_name" => {},
"type" => "fvh",
"boundary_chars" => "\n"
}
}
end
Loading
Loading
module Elasticsearch
module Git
VERSION = '1.0.2'
VERSION = '1.1.0'
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment