Module: ActsAsXapian::ClassMethods
- Defined in:
- lib/acts_as_xapian/base.rb
Instance Method Summary collapse
-
#find_with_xapian(search_term, options = {}) ⇒ Object
Model.find_with_xapian(“Search Term OR Phrase”) => Array of Records.
- #search_with_xapian(search_term, options = {}) ⇒ Object
- #with_xapian_scope(ids) ⇒ Object
-
#xapian? ⇒ Boolean
this method should return true if the integration of xapian on self is complete.
Instance Method Details
#find_with_xapian(search_term, options = {}) ⇒ Object
Model.find_with_xapian(“Search Term OR Phrase”)
> Array of Records
this can be used through association proxies /!\ DANGEROUS MAGIC /!\ example: as seen here: pastie.org/270114
96 97 98 |
# File 'lib/acts_as_xapian/base.rb', line 96 def find_with_xapian(search_term, = {}) search_with_xapian(search_term, ).results.map {|x| x[:model] } end |
#search_with_xapian(search_term, options = {}) ⇒ Object
100 101 102 |
# File 'lib/acts_as_xapian/base.rb', line 100 def search_with_xapian(search_term, = {}) ActsAsXapian::Search.new([self], search_term, ) end |
#with_xapian_scope(ids) ⇒ Object
104 105 106 |
# File 'lib/acts_as_xapian/base.rb', line 104 def with_xapian_scope(ids) with_scope(:find => {:conditions => {"#{self.table_name}.#{self.primary_key}" => ids}, :include => self.[:eager_load]}) { yield } end |
#xapian? ⇒ Boolean
this method should return true if the integration of xapian on self is complete
109 110 111 |
# File 'lib/acts_as_xapian/base.rb', line 109 def xapian? self.included_modules.include?(InstanceMethods) && self.extended_by.include?(ClassMethods) end |