Module: Fuzzzy::Mongoid::Index
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/fuzzzy/orm/mongoid/index.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #change_field_index(command, field, options) ⇒ Object
- #change_indexes(command, condition = nil) ⇒ Object
- #create_fuzzzy_indexes(&block) ⇒ Object
- #delete_fuzzzy_indexes(&block) ⇒ Object
Instance Method Details
#change_field_index(command, field, options) ⇒ Object
78 79 80 81 82 83 |
# File 'lib/fuzzzy/orm/mongoid/index.rb', line 78 def change_field_index command, field, self.class.indexer([:method]).send(command, .merge( :id => self.id, :dictionary_string => self.send(field) )) end |
#change_indexes(command, condition = nil) ⇒ Object
71 72 73 74 75 76 |
# File 'lib/fuzzzy/orm/mongoid/index.rb', line 71 def change_indexes command, condition=nil self.class.fuzzzy_indexes.each do |(field, opts)| change_field_index(command, field, opts.dup) if command == :delete_index || self.changed.include?(field.to_s) end end |
#create_fuzzzy_indexes(&block) ⇒ Object
67 68 69 |
# File 'lib/fuzzzy/orm/mongoid/index.rb', line 67 def create_fuzzzy_indexes &block change_indexes(:create_index, &block) end |
#delete_fuzzzy_indexes(&block) ⇒ Object
63 64 65 |
# File 'lib/fuzzzy/orm/mongoid/index.rb', line 63 def delete_fuzzzy_indexes &block change_indexes(:delete_index, &block) end |