Class: LogMagic::SearchkickExplainer
- Inherits:
-
Object
- Object
- LogMagic::SearchkickExplainer
show all
- Includes:
- JSONUtils, TemplatingUtils
- Defined in:
- lib/log_magic/explainers/searchkick_explainer.rb
Defined Under Namespace
Classes: AnalyzerExplainerSection, BoostExplainerSection, DisMaxExplainerSection, FuzzyTranspositionsSection, MatchExplainerSection, MaxExpansionsSection, QueryExplainerSection, SettingsExplainerSection
Instance Method Summary
collapse
#enriche, #match_regex, #rendered_template, #template_path
Methods included from JSONUtils
#parse_json, #pretty_print_json, #query_hash
Constructor Details
9
10
11
|
# File 'lib/log_magic/explainers/searchkick_explainer.rb', line 9
def initialize
@persistance_layer = ::LogMagic::PersistanceLayer.new
end
|
Instance Method Details
#elasticsearch_url ⇒ Object
17
18
19
|
# File 'lib/log_magic/explainers/searchkick_explainer.rb', line 17
def elasticsearch_url
@persistance_layer.retrieve_value(@uuid, 'elasticsearch_url')
end
|
#explained_query ⇒ Object
25
26
27
|
# File 'lib/log_magic/explainers/searchkick_explainer.rb', line 25
def explained_query
QueryExplainerSection.new(query_json)
end
|
#query_json ⇒ Object
13
14
15
|
# File 'lib/log_magic/explainers/searchkick_explainer.rb', line 13
def query_json
@persistance_layer.retrieve_value(@uuid, 'query_json')
end
|
#settings_explainer_section ⇒ Object
21
22
23
|
# File 'lib/log_magic/explainers/searchkick_explainer.rb', line 21
def settings_explainer_section
SettingsExplainerSection.new(elasticsearch_url)
end
|
#start ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/log_magic/explainers/searchkick_explainer.rb', line 29
def start
app = Proc.new do |env|
@uuid = env['PATH_INFO'][1..-1]
body = rendered_template
['200', {'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s}, [body]]
end
Rack::Handler::WEBrick.run app, Port: 7467,
Logger: WEBrick::Log::new('/tmp/log_magic.log')
end
|
#template_name ⇒ Object
41
42
43
|
# File 'lib/log_magic/explainers/searchkick_explainer.rb', line 41
def template_name
'searchkick.haml'
end
|