gitlab-elasticsearch-git 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e809a9160b2028a663c05b3b90f64600ffd8f586
4
- data.tar.gz: 299cb60d6f23e70f4970e1aef248acf3d95e6416
3
+ metadata.gz: a1ed1a40fac4c237888663a8b9a15606a77c09d0
4
+ data.tar.gz: 28c65fcdcb6953ed270d4c6e4d5ee91137e7fa04
5
5
  SHA512:
6
- metadata.gz: 45defe4936e8c8de624174cc9aadcc25e46b1f6bccc95d37f267e2b7b617c3704c7756b4c539f7e6e6f232d9505edf066d899885350dfb702ae8e0890427bf90
7
- data.tar.gz: 7af8adfc3a1912e441f2018946e171f63c5c76291f706dd230d8693c93a6132b5b3dda21bd1c5d2e5ad24d6d6f8924e465299041cf8a34c78babbdb281f4b291
6
+ metadata.gz: 69199b236f9ee39ea45b38928272cf3c968af829a49d3c27c87b4f0a4b8b9c783d3b7b7f95ce255b9b22e8d433cc6834ce1797c25150fac60c1d798dd446960d
7
+ data.tar.gz: f164040b0925cabbdce3c4f37d5818141d084665001ea55f800284a2b04e69e8f0b2534533f88074de9192921f749627f09ebba367eaa2f7256d0a4b56425011
@@ -1,7 +1,7 @@
1
1
  image: "ruby:2.3"
2
2
 
3
3
  services:
4
- - elasticsearch:latest
4
+ - elasticsearch:5.1
5
5
 
6
6
  variables:
7
7
  ELASTICSEARCH_HOST: "elasticsearch"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-elasticsearch-git (1.0.0)
4
+ gitlab-elasticsearch-git (1.1.0)
5
5
  activemodel (~> 4.2)
6
6
  activesupport (~> 4.2)
7
7
  charlock_holmes (~> 0.7)
@@ -22,7 +22,7 @@ GEM
22
22
  minitest (~> 5.1)
23
23
  thread_safe (~> 0.3, >= 0.3.4)
24
24
  tzinfo (~> 1.1)
25
- builder (3.2.2)
25
+ builder (3.2.3)
26
26
  charlock_holmes (0.7.3)
27
27
  coderay (1.1.0)
28
28
  diff-lcs (1.2.5)
@@ -95,4 +95,4 @@ DEPENDENCIES
95
95
  rugged (~> 0.24)
96
96
 
97
97
  BUNDLED WITH
98
- 1.12.5
98
+ 1.13.6
@@ -21,55 +21,52 @@ module Elasticsearch
21
21
  include Elasticsearch::Git::Model
22
22
  include Elasticsearch::Git::EncoderHelper
23
23
 
24
- mapping _timestamp: { enabled: true }, _parent: { type: 'project' } do
24
+ mapping _parent: { type: 'project' } do
25
25
  indexes :blob do
26
- indexes :id, type: :string,
26
+ indexes :id, type: :text,
27
27
  index_options: 'offsets',
28
28
  analyzer: :sha_analyzer
29
- indexes :rid, type: :string,
30
- index: :not_analyzed
31
- indexes :oid, type: :string,
29
+ indexes :rid, type: :keyword
30
+ indexes :oid, type: :text,
32
31
  index_options: 'offsets',
33
32
  analyzer: :sha_analyzer
34
- indexes :commit_sha, type: :string,
33
+ indexes :commit_sha, type: :text,
35
34
  index_options: 'offsets',
36
35
  analyzer: :sha_analyzer
37
- indexes :path, type: :string,
36
+ indexes :path, type: :text,
38
37
  analyzer: :path_analyzer
39
- indexes :file_name, type: :string,
38
+ indexes :file_name, type: :text,
40
39
  analyzer: :code_analyzer,
41
40
  search_analyzer: :code_search_analyzer
42
- indexes :content, type: :string,
41
+ indexes :content, type: :text,
43
42
  index_options: 'offsets',
44
43
  analyzer: :code_analyzer,
45
44
  search_analyzer: :code_search_analyzer
46
- indexes :language, type: :string,
47
- index: :not_analyzed
45
+ indexes :language, type: :keyword
48
46
  end
49
47
 
50
48
  indexes :commit do
51
- indexes :id, type: :string,
49
+ indexes :id, type: :text,
52
50
  index_options: 'offsets',
53
51
  analyzer: :sha_analyzer
54
- indexes :rid, type: :string,
55
- index: :not_analyzed
56
- indexes :sha, type: :string,
52
+ indexes :rid, type: :keyword
53
+ indexes :sha, type: :text,
57
54
  index_options: 'offsets',
58
55
  analyzer: :sha_analyzer
59
56
 
60
57
  indexes :author do
61
- indexes :name, type: :string, index_options: 'offsets'
62
- indexes :email, type: :string, index_options: 'offsets'
58
+ indexes :name, type: :text, index_options: 'offsets'
59
+ indexes :email, type: :text, index_options: 'offsets'
63
60
  indexes :time, type: :date, format: :basic_date_time_no_millis
64
61
  end
65
62
 
66
63
  indexes :commiter do
67
- indexes :name, type: :string, index_options: 'offsets'
68
- indexes :email, type: :string, index_options: 'offsets'
64
+ indexes :name, type: :text, index_options: 'offsets'
65
+ indexes :email, type: :text, index_options: 'offsets'
69
66
  indexes :time, type: :date, format: :basic_date_time_no_millis
70
67
  end
71
68
 
72
- indexes :message, type: :string, index_options: 'offsets'
69
+ indexes :message, type: :text, index_options: 'offsets'
73
70
  end
74
71
  end
75
72
 
@@ -465,16 +462,7 @@ module Elasticsearch
465
462
 
466
463
  options[:order] = :default if options[:order].blank?
467
464
 
468
- order = case options[:order].to_sym
469
- when :recently_indexed
470
- { _timestamp: { order: :desc, mode: :min } }
471
- when :last_indexed
472
- { _timestamp: { order: :asc, mode: :min } }
473
- else
474
- {}
475
- end
476
-
477
- query_hash[:sort] = order.blank? ? [:_score] : [order, :_score]
465
+ query_hash[:sort] = [:_score]
478
466
 
479
467
  res = self.__elasticsearch__.search(query_hash)
480
468
  {
@@ -527,26 +515,16 @@ module Elasticsearch
527
515
 
528
516
  options[:order] = :default if options[:order].blank?
529
517
 
530
- order = case options[:order].to_sym
531
- when :recently_indexed
532
- { _timestamp: { order: :desc, mode: :min } }
533
- when :last_indexed
534
- { _timestamp: { order: :asc, mode: :min } }
535
- else
536
- {}
537
- end
538
-
539
- query_hash[:sort] = order.blank? ? [:_score] : [order, :_score]
518
+ query_hash[:sort] = [:_score]
540
519
 
541
520
  if options[:highlight]
542
521
  query_hash[:highlight] = {
543
522
  pre_tags: ["gitlabelasticsearch→"],
544
523
  post_tags: ["←gitlabelasticsearch"],
524
+ order: "score",
545
525
  fields: {
546
526
  "blob.content" => {},
547
527
  "blob.file_name" => {},
548
- "type" => "fvh",
549
- "boundary_chars" => "\n"
550
528
  }
551
529
  }
552
530
  end
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module Git
3
- VERSION = '1.0.2'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
@@ -5,7 +5,7 @@ module ElasticHelper
5
5
  end
6
6
 
7
7
  def remove_index(index_name)
8
- system("curl -XDELETE '#{elastic_url}/#{index_name}/' > /dev/null 2>&1")
8
+ system("curl -XDELETE '#{elastic_url}#{index_name}/' > /dev/null 2>&1")
9
9
  end
10
10
 
11
11
  def elastic_url
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-elasticsearch-git
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Kumanyaev
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-09-19 00:00:00.000000000 Z
13
+ date: 2017-01-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: elasticsearch-model
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  requirements: []
161
161
  rubyforge_project:
162
- rubygems_version: 2.5.1
162
+ rubygems_version: 2.5.2
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: Elasticsearch integrations for git repositories.