class Mongoid::Giza::Indexer
Routines related to creating the defined indexes in sphinx
Public Class Methods
new()
click to toggle source
Creates the Indexer
instance
# File lib/mongoid/giza/indexer.rb, line 8 def initialize @configuration = Mongoid::Giza::Configuration.instance @controller = Riddle::Controller.new(@configuration, @configuration.file.output_path) end
Public Instance Methods
full_index!()
click to toggle source
Index
everything, regenerating all dynamic indexes from all classes
# File lib/mongoid/giza/indexer.rb, line 15 def full_index! @configuration.clear_generated_indexes giza_classes.each(&:regenerate_sphinx_indexes) @configuration.render index! end
giza_classes()
click to toggle source
@return [Array<Class>] all Mongoid
models that include the
{Mongoid::Giza} module
# File lib/mongoid/giza/indexer.rb, line 36 def giza_classes Mongoid.models.select { |model| model.include?(Mongoid::Giza) } end
index!(*names)
click to toggle source
Executes the sphinx indexer
@param names [Array<Symbol>] name of the indexes that should be indexed.
If not provided all indexes from the configuration file are indexed
@param options [Hash] additional options to pass to
Riddle::Controller#index
@option options [TrueClass, FalseClass] :verbose shows the indexer
output
# File lib/mongoid/giza/indexer.rb, line 30 def index!(*names) @controller.index(*names) end