class SearchkickExplainer::CustomAnalyzerHover
Public Class Methods
new(query_explainer, index_settings)
click to toggle source
# File lib/log_magic/explainers/searchkick/custom_analyzer_hover.rb, line 4 def initialize(query_explainer, index_settings) @query_explainer = query_explainer @index_settings = JSON.parse(index_settings) end
Public Instance Methods
custom_analyzer_matcher()
click to toggle source
# File lib/log_magic/explainers/searchkick/custom_analyzer_hover.rb, line 23 def custom_analyzer_matcher /[^w]analyzer[^w]\n[^<]*<\/a>\n: "([^"]*)"/ end
enriche()
click to toggle source
# File lib/log_magic/explainers/searchkick/custom_analyzer_hover.rb, line 9 def enriche @query_explainer.query_json.clone.scan(custom_analyzer_matcher) do |match| inject_hover(match[0]) end end
hover_template(match)
click to toggle source
# File lib/log_magic/explainers/searchkick/custom_analyzer_hover.rb, line 19 def hover_template(match) ::LogMagic::HoverRenderer.new(match, HashDeepSearch.new(@index_settings).search(match)) end
inject_hover(match)
click to toggle source
# File lib/log_magic/explainers/searchkick/custom_analyzer_hover.rb, line 15 def inject_hover(match) @query_explainer.query_json.sub!(/[^w]#{match}[^w]/, hover_template(match).rendered_template) end