Class: CouchRest::Database

Inherits:
Object
  • Object
show all
Includes:
Search::Escape
Defined in:
lib/couchrest_model_search.rb

Instance Method Summary collapse

Methods included from Search::Escape

#escape_special_characters, #lucene_special_characters

Instance Method Details

#escaped_search(klass, view_fn, query, options = {}) ⇒ Object



96
97
98
# File 'lib/couchrest_model_search.rb', line 96

def escaped_search(klass, view_fn, query, options={})
  search klass, view_fn, escape_special_characters(query), options
end

#search(klass, view_fn, query, options = {}) ⇒ Object



88
89
90
91
92
93
94
# File 'lib/couchrest_model_search.rb', line 88

def search(klass, view_fn, query, options={})
  url = CouchRest.paramify_url("#{@root}/_fti/_design/#{klass}/#{view_fn}", options.merge(:q => query))
  ActiveSupport::Notifications.instrument("search.lucene",
                                              :query => url) do
    CouchRest.get url
  end
end