Method: Mebla::Search#only
- Defined in:
- lib/mebla/search.rb
#only(*fields) ⇒ Mebla::Search
Filters the results according to the criteria
- Get all indexed Posts and filter them by tags and authors
-
Post.search(“*”).only(:tag => [“ruby”, “rails”], :author => [“cousine”])
163 164 165 166 167 168 169 |
# File 'lib/mebla/search.rb', line 163 def only(*fields) return if fields.empty? fields.each do |field| @slingshot_search = @slingshot_search.filter(:terms, field) end self end |