log_magic 0.0.5 → 0.0.6

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: 86b235416d827dc6a190d2098a617b72cbafb3bf
4
- data.tar.gz: b3ff933f789f7bb66a8331181b75589fd4452d3c
3
+ metadata.gz: 41025b0281e6367ff8b1c5b080fd92ac7632d5ee
4
+ data.tar.gz: 7f149bcc08e1ce2a648d27df4e55bef3b34dc1ea
5
5
  SHA512:
6
- metadata.gz: 2ff908f15c4906c78f1b2436e62f4e2dbe24b26436c6acf6e514f95fc856bccc7cfc922730fdda0c269627210b44484a2f7ce75540a6fd306a1c2ab4184bdc47
7
- data.tar.gz: 3ec53d4f8b0e60c98900a96f3608dc0a2e6f8fad2b95d50e2da4a0261361532452455611462eb230f0f276717f6542d9fccdb400259947afad2fe30ffba021b1
6
+ metadata.gz: 96b931b3a04f2937f861fda5de7197b52ae8a64a7859bc674251ffb9d6f32efbbb3b42867904dfe9007815f7f0bae9963f9edac16cd531443d82e6f1623c932b
7
+ data.tar.gz: 03c699de9bdec97e3059b13938c4a730feb978e32a44ef65ff9925a1828336f2050f64e4db46f9016c1297b02e314b2eb82112aba6b00e7cb076ad33b99fb00d
data/bin/rebuild CHANGED
@@ -1,2 +1,2 @@
1
1
  gem build log_magic.gemspec
2
- gem install log_magic-0.0.4.gem
2
+ gem install log_magic-0.0.5.gem
@@ -0,0 +1,2 @@
1
+ %a{href: 'https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-analyzers.html'}
2
+ 'analyzer'
@@ -0,0 +1,2 @@
1
+ %a{href: 'https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#query-dsl-match-query-fuzziness'}
2
+ 'fuzzy_transpositions'
@@ -0,0 +1,2 @@
1
+ %a{href: 'https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#query-dsl-match-query-fuzziness'}
2
+ 'max_expansions'
@@ -0,0 +1,15 @@
1
+ class LogMagic::SearchkickExplainer::AnalyzerExplainerSection
2
+ include ::LogMagic::TemplatingUtils
3
+
4
+ def initialize(query_json)
5
+ @query_json = query_json
6
+ end
7
+
8
+ def match_regex
9
+ /[^\w]analyzer[^\w]/
10
+ end
11
+
12
+ def template_name
13
+ 'analyzer.haml'
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ class LogMagic::SearchkickExplainer::FuzzyTranspositionsSection
2
+ include ::LogMagic::TemplatingUtils
3
+
4
+ def initialize(query_json)
5
+ @query_json = query_json
6
+ end
7
+
8
+ def match_regex
9
+ /[^\w]fuzzy_transpositions[^\w]/
10
+ end
11
+
12
+ def template_name
13
+ 'fuzzy_transpositions.haml'
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ class LogMagic::SearchkickExplainer::MaxExpansionsSection
2
+ include ::LogMagic::TemplatingUtils
3
+
4
+ def term_name
5
+ 'max_expansions'
6
+ end
7
+ end
@@ -20,7 +20,10 @@ class LogMagic::SearchkickExplainer::QueryExplainerSection
20
20
  [
21
21
  ::LogMagic::SearchkickExplainer::DisMaxExplainerSection,
22
22
  ::LogMagic::SearchkickExplainer::BoostExplainerSection,
23
- ::LogMagic::SearchkickExplainer::MatchExplainerSection
23
+ ::LogMagic::SearchkickExplainer::MatchExplainerSection,
24
+ ::LogMagic::SearchkickExplainer::AnalyzerExplainerSection,
25
+ ::LogMagic::SearchkickExplainer::FuzzyTranspositionsSection,
26
+ ::LogMagic::SearchkickExplainer::MaxExpansionsSection
24
27
  ]
25
28
  end
26
29
 
@@ -1,4 +1,8 @@
1
1
  module LogMagic::TemplatingUtils
2
+ def initialize(query_json)
3
+ @query_json = query_json
4
+ end
5
+
2
6
  def rendered_template
3
7
  engine = Haml::Engine.new(File.read(template_path))
4
8
  engine.render(self)
@@ -13,4 +17,12 @@ module LogMagic::TemplatingUtils
13
17
  def enriche
14
18
  @query_json.gsub!(match_regex, rendered_template)
15
19
  end
20
+
21
+ def match_regex
22
+ /[^\w]#{term_name}[^\w]/
23
+ end
24
+
25
+ def template_name
26
+ "#{term_name}.haml"
27
+ end
16
28
  end
data/lib/log_magic.rb CHANGED
@@ -52,10 +52,11 @@ require 'log_magic/utils/templating_utils'
52
52
  require 'log_magic/log_listener'
53
53
  require 'log_magic/refiners/searchkick_refiner'
54
54
  require 'log_magic/printers/searchkick_printer'
55
+
55
56
  require 'log_magic/explainers/searchkick_explainer'
56
- require 'log_magic/explainers/explainer_sections/dis_max_explainer'
57
- require 'log_magic/explainers/explainer_sections/match_explainer'
58
- require 'log_magic/explainers/explainer_sections/boost_explainer'
59
- require 'log_magic/explainers/explainer_sections/settings_explainer'
60
- require 'log_magic/explainers/explainer_sections/query_explainer'
57
+
58
+ Dir.glob("lib/log_magic/explainers/**/*.rb").each do |explainer|
59
+ require explainer.gsub('lib/', '')
60
+ end
61
+
61
62
  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.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Korfmann
@@ -105,15 +105,21 @@ files:
105
105
  - bin/log_magic
106
106
  - bin/rebuild
107
107
  - lib/log_magic.rb
108
+ - lib/log_magic/explainer_templates/analyzer.haml
108
109
  - lib/log_magic/explainer_templates/boost.haml
109
110
  - lib/log_magic/explainer_templates/dis_max.haml
111
+ - lib/log_magic/explainer_templates/fuzzy_transpositions.haml
110
112
  - lib/log_magic/explainer_templates/match.haml
113
+ - lib/log_magic/explainer_templates/max_expansions.haml
111
114
  - lib/log_magic/explainer_templates/query.haml
112
115
  - lib/log_magic/explainer_templates/searchkick.haml
113
116
  - lib/log_magic/explainer_templates/settings.haml
117
+ - lib/log_magic/explainers/explainer_sections/analyzer_explainer.rb
114
118
  - lib/log_magic/explainers/explainer_sections/boost_explainer.rb
115
119
  - lib/log_magic/explainers/explainer_sections/dis_max_explainer.rb
120
+ - lib/log_magic/explainers/explainer_sections/fuzzy_transpositions_explainer.rb
116
121
  - lib/log_magic/explainers/explainer_sections/match_explainer.rb
122
+ - lib/log_magic/explainers/explainer_sections/max_expansions_section.rb
117
123
  - lib/log_magic/explainers/explainer_sections/query_explainer.rb
118
124
  - lib/log_magic/explainers/explainer_sections/settings_explainer.rb
119
125
  - lib/log_magic/explainers/searchkick_explainer.rb