log_magic 0.0.4 → 0.0.5
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/lib/log_magic/explainer_templates/boost.haml +2 -4
- data/lib/log_magic/explainer_templates/dis_max.haml +2 -4
- data/lib/log_magic/explainer_templates/match.haml +2 -4
- data/lib/log_magic/explainer_templates/query.haml +2 -0
- data/lib/log_magic/explainer_templates/searchkick.haml +3 -6
- data/lib/log_magic/explainers/explainer_sections/boost_explainer.rb +2 -6
- data/lib/log_magic/explainers/explainer_sections/dis_max_explainer.rb +2 -6
- data/lib/log_magic/explainers/explainer_sections/match_explainer.rb +2 -6
- data/lib/log_magic/explainers/explainer_sections/query_explainer.rb +34 -0
- data/lib/log_magic/explainers/searchkick_explainer.rb +4 -16
- data/lib/log_magic/utils/templating_utils.rb +4 -0
- data/lib/log_magic.rb +1 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86b235416d827dc6a190d2098a617b72cbafb3bf
|
4
|
+
data.tar.gz: b3ff933f789f7bb66a8331181b75589fd4452d3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ff908f15c4906c78f1b2436e62f4e2dbe24b26436c6acf6e514f95fc856bccc7cfc922730fdda0c269627210b44484a2f7ce75540a6fd306a1c2ab4184bdc47
|
7
|
+
data.tar.gz: 3ec53d4f8b0e60c98900a96f3608dc0a2e6f8fad2b95d50e2da4a0261361532452455611462eb230f0f276717f6542d9fccdb400259947afad2fe30ffba021b1
|
@@ -5,12 +5,8 @@ class LogMagic::SearchkickExplainer::BoostExplainerSection
|
|
5
5
|
@query_json = query_json
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
def explanation
|
13
|
-
rendered_template
|
8
|
+
def match_regex
|
9
|
+
/[^\w]boost[^\w]/
|
14
10
|
end
|
15
11
|
|
16
12
|
def template_name
|
@@ -5,12 +5,8 @@ class LogMagic::SearchkickExplainer::DisMaxExplainerSection
|
|
5
5
|
@query_json = query_json
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
def explanation
|
13
|
-
rendered_template
|
8
|
+
def match_regex
|
9
|
+
/[^\w]dis_max[^\w]/
|
14
10
|
end
|
15
11
|
|
16
12
|
def template_name
|
@@ -5,12 +5,8 @@ class LogMagic::SearchkickExplainer::MatchExplainerSection
|
|
5
5
|
@query_json = query_json
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
def explanation
|
13
|
-
rendered_template
|
8
|
+
def match_regex
|
9
|
+
/[^\w]match[^\w]/
|
14
10
|
end
|
15
11
|
|
16
12
|
def template_name
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class LogMagic::SearchkickExplainer::QueryExplainerSection
|
2
|
+
include ::LogMagic::TemplatingUtils
|
3
|
+
include ::LogMagic::JSONUtils
|
4
|
+
attr_reader :query_json
|
5
|
+
|
6
|
+
def initialize(query_json)
|
7
|
+
@query_json = pretty_print_json(query_json)
|
8
|
+
enriche_query_json
|
9
|
+
end
|
10
|
+
|
11
|
+
def explanation
|
12
|
+
rendered_template
|
13
|
+
end
|
14
|
+
|
15
|
+
def template_name
|
16
|
+
'query.haml'
|
17
|
+
end
|
18
|
+
|
19
|
+
def explainer_section_classes
|
20
|
+
[
|
21
|
+
::LogMagic::SearchkickExplainer::DisMaxExplainerSection,
|
22
|
+
::LogMagic::SearchkickExplainer::BoostExplainerSection,
|
23
|
+
::LogMagic::SearchkickExplainer::MatchExplainerSection
|
24
|
+
]
|
25
|
+
end
|
26
|
+
|
27
|
+
def enriche_query_json
|
28
|
+
explainer_section_classes.map do |explainer_section_class|
|
29
|
+
explainer_section_class.new(query_json)
|
30
|
+
end.select do |explainer_section|
|
31
|
+
explainer_section.enriche
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -5,8 +5,8 @@ require 'haml'
|
|
5
5
|
class LogMagic::SearchkickExplainer
|
6
6
|
include ::LogMagic::JSONUtils
|
7
7
|
include ::LogMagic::TemplatingUtils
|
8
|
-
|
9
|
-
def initialize
|
8
|
+
|
9
|
+
def initialize
|
10
10
|
@persistance_layer = ::LogMagic::PersistanceLayer.new
|
11
11
|
end
|
12
12
|
|
@@ -22,20 +22,8 @@ class LogMagic::SearchkickExplainer
|
|
22
22
|
SettingsExplainerSection.new(elasticsearch_url)
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
|
27
|
-
DisMaxExplainerSection,
|
28
|
-
BoostExplainerSection,
|
29
|
-
MatchExplainerSection
|
30
|
-
]
|
31
|
-
end
|
32
|
-
|
33
|
-
def explainer_sections
|
34
|
-
explainer_section_classes.map do |explainer_section_class|
|
35
|
-
explainer_section_class.new(query_json)
|
36
|
-
end.select do |explainer_section|
|
37
|
-
explainer_section.matches?
|
38
|
-
end
|
25
|
+
def explained_query
|
26
|
+
QueryExplainerSection.new(query_json)
|
39
27
|
end
|
40
28
|
|
41
29
|
def start
|
data/lib/log_magic.rb
CHANGED
@@ -57,4 +57,5 @@ require 'log_magic/explainers/explainer_sections/dis_max_explainer'
|
|
57
57
|
require 'log_magic/explainers/explainer_sections/match_explainer'
|
58
58
|
require 'log_magic/explainers/explainer_sections/boost_explainer'
|
59
59
|
require 'log_magic/explainers/explainer_sections/settings_explainer'
|
60
|
+
require 'log_magic/explainers/explainer_sections/query_explainer'
|
60
61
|
require 'log_magic/persistance_layer'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log_magic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Korfmann
|
@@ -108,11 +108,13 @@ files:
|
|
108
108
|
- lib/log_magic/explainer_templates/boost.haml
|
109
109
|
- lib/log_magic/explainer_templates/dis_max.haml
|
110
110
|
- lib/log_magic/explainer_templates/match.haml
|
111
|
+
- lib/log_magic/explainer_templates/query.haml
|
111
112
|
- lib/log_magic/explainer_templates/searchkick.haml
|
112
113
|
- lib/log_magic/explainer_templates/settings.haml
|
113
114
|
- lib/log_magic/explainers/explainer_sections/boost_explainer.rb
|
114
115
|
- lib/log_magic/explainers/explainer_sections/dis_max_explainer.rb
|
115
116
|
- lib/log_magic/explainers/explainer_sections/match_explainer.rb
|
117
|
+
- lib/log_magic/explainers/explainer_sections/query_explainer.rb
|
116
118
|
- lib/log_magic/explainers/explainer_sections/settings_explainer.rb
|
117
119
|
- lib/log_magic/explainers/searchkick_explainer.rb
|
118
120
|
- lib/log_magic/log_listener.rb
|