Class: Query

Inherits:
Object show all
Defined in:
lib/picolena/templates/app/models/query.rb

Class Method Summary collapse

Class Method Details

.content_terms(raw_query) ⇒ Object

Returns terms related to content. Useful for cache highlighting



9
10
11
# File 'lib/picolena/templates/app/models/query.rb', line 9

def content_terms(raw_query)
  Query.extract_from(raw_query).terms(Indexer.index.searcher).select{|term| term.field==:content}.collect{|term| term.text}.uniq
end

.extract_from(raw_query) ⇒ Object

Returns a Ferret::Query from a raw String query.



4
5
6
# File 'lib/picolena/templates/app/models/query.rb', line 4

def extract_from(raw_query)
  parser.parse(convert_to_english(raw_query))
end