gitlab-elasticsearch-git 0.0.14 → 0.0.15
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 +4 -4
- data/CHANGELOG +3 -0
- data/lib/elasticsearch/git/repository.rb +12 -2
- data/lib/elasticsearch/git/version.rb +1 -1
- data/spec/main_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 805299d2c9977f838c91ad88a5ae27415345ad8d
|
4
|
+
data.tar.gz: f4c2c5211cb767f10042b1373d4ebbcafe9e0b89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73ce23ee1c90b94713d5b4dc49878cb6a110de5ebec9a002abc423249532337e0cf544ff0e6bb6b43c118373afd27b34e87645bb4e6a6b1c080e7497287e1b99
|
7
|
+
data.tar.gz: 9e1227a3b202f421667e45e3adfa1bef6db62096f2f00ab8eae3c35bafe60ef12b92bdc533413ccbcb1ead5f5e0d48f1d40b049a96d0ba032c64a05127002a34
|
data/CHANGELOG
CHANGED
@@ -28,6 +28,7 @@ module Elasticsearch
|
|
28
28
|
indexes :oid, type: :string, index_options: 'offsets', analyzer: :code_analyzer
|
29
29
|
indexes :commit_sha, type: :string, index_options: 'offsets', analyzer: :sha_analyzer
|
30
30
|
indexes :path, type: :string, analyzer: :path_analyzer
|
31
|
+
indexes :file_name, type: :string, analyzer: :code_analyzer
|
31
32
|
indexes :content, type: :string, index_options: 'offsets', analyzer: :code_analyzer
|
32
33
|
indexes :language, type: :string, index: :not_analyzed
|
33
34
|
end
|
@@ -119,6 +120,15 @@ module Elasticsearch
|
|
119
120
|
content: blob.data,
|
120
121
|
commit_sha: target_sha,
|
121
122
|
path: blob.path,
|
123
|
+
|
124
|
+
# We're duplicating file_name parameter here because
|
125
|
+
# we need another analyzer for it.
|
126
|
+
# Ideally this should be done with copy_to: 'blob.file_name' option
|
127
|
+
# but it does not work in ES v2.3.*. We're doing it so to not make users
|
128
|
+
# install newest versions
|
129
|
+
# https://github.com/elastic/elasticsearch-mapper-attachments/issues/124
|
130
|
+
file_name: blob.path,
|
131
|
+
|
122
132
|
language: blob.language ? blob.language.name : "Text"
|
123
133
|
}
|
124
134
|
}
|
@@ -455,7 +465,7 @@ module Elasticsearch
|
|
455
465
|
multi_match: {
|
456
466
|
query: query,
|
457
467
|
operator: :and,
|
458
|
-
fields: [ 'blob.content', 'blob.
|
468
|
+
fields: [ 'blob.content', 'blob.file_name' ]
|
459
469
|
}
|
460
470
|
}
|
461
471
|
}
|
@@ -517,7 +527,7 @@ module Elasticsearch
|
|
517
527
|
post_tags: ["←gitlabelasticsearch"],
|
518
528
|
fields: {
|
519
529
|
"blob.content" => {},
|
520
|
-
"blob.
|
530
|
+
"blob.file_name" => {},
|
521
531
|
"type" => "fvh",
|
522
532
|
"boundary_chars" => "\n"
|
523
533
|
}
|
data/spec/main_spec.rb
CHANGED
@@ -42,6 +42,19 @@ describe TestRepository do
|
|
42
42
|
expect(repo.search('def')[:blobs][:total_count]).to eq(4)
|
43
43
|
end
|
44
44
|
|
45
|
+
it "searches through filename" do
|
46
|
+
repo = TestRepository.new
|
47
|
+
repo.index_blobs
|
48
|
+
|
49
|
+
TestRepository.__elasticsearch__.refresh_index!
|
50
|
+
|
51
|
+
found_version_file = repo.search('version')[:blobs][:results].any? do |result|
|
52
|
+
result["_source"]["blob"]["file_name"] == "VERSION"
|
53
|
+
end
|
54
|
+
|
55
|
+
expect(found_version_file).to be_truthy
|
56
|
+
end
|
57
|
+
|
45
58
|
it "indexes specified commits" do
|
46
59
|
repo = TestRepository.new
|
47
60
|
repo.index_commits(
|
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: 0.0.
|
4
|
+
version: 0.0.15
|
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-05-
|
13
|
+
date: 2016-05-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: elasticsearch-model
|