Module: SearchContext::Methods

Extended by:
ActiveSupport::Concern
Defined in:
lib/search_context/methods.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#rank_fObject



61
62
63
# File 'lib/search_context/methods.rb', line 61

def rank_f
  rank.to_f
end

#spotObject

for the last spots by tsearch command. returns the original word it matched against



69
70
71
72
73
74
75
76
77
78
# File 'lib/search_context/methods.rb', line 69

def spot
  case
  when respond_to?(:exact_spot)
    exact_spot
  when respond_to?(:trigram_spot)
   trigram_spot
  else
   tsearch_spot
  end
end

#trigram_rank_fObject



65
66
67
# File 'lib/search_context/methods.rb', line 65

def trigram_rank_f
  trigram_rank.to_f
end

#tsearch_spotObject



80
81
82
83
# File 'lib/search_context/methods.rb', line 80

def tsearch_spot
  return $1 if tsearch_location.scan(/<b>(\w.*)<\/b>/)
  return $1 if tsearch_location_rewritten.scan(/<b>(\w.*)<\/b>/)
end