Module: ActsAsFulltextable::FulltextableClassMethods
- Defined in:
- lib/acts_as_fulltextable.rb
Instance Method Summary collapse
-
#find_fulltext(query, options = {}) ⇒ Object
Performs full-text search for objects of this class.
- #fulltext_fields ⇒ Object
Instance Method Details
#find_fulltext(query, options = {}) ⇒ Object
Performs full-text search for objects of this class. It takes three options:
-
limit: maximum number of rows to return. Defaults to 10.
-
offset: offset to apply to query. Defaults to 0.
-
page: only available with will_paginate plugin installed.
-
active_record: wether a ActiveRecord objects should be returned or an Array of [class_name, id]
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/acts_as_fulltextable.rb', line 46 def find_fulltext(query, = {}) = {:active_record => true} = .merge() unless [:page] = {:limit => 10, :offset => 0}.merge() end [:only] = self.to_s.underscore.to_sym # Only look for object belonging to this class # Pass from what class search is invoked. [:search_class] = Kernel.const_get(self.to_s) FulltextRow.search(query, ) end |
#fulltext_fields ⇒ Object
35 36 37 |
# File 'lib/acts_as_fulltextable.rb', line 35 def fulltext_fields self.[:fields] end |