How to call optimize

I was under the impression that Model.rebuild_index will automatically
call optimize in the end. But that doesn’t seem to be the case.

After running Model.rebuild_index how do I optimize the index. I am
using aaf most stable and also ferret most stable.

def rebuild_index(*models)
models << aaf_configuration[:class_name] unless
models.include?(aaf_configuration[:class_name])
models = models.flatten.uniq.map(&:constantize)
logger.debug “rebuild index: #{models.inspect}”
index =
Ferret::Index::Index.new(aaf_configuration[:ferret].dup.update(:auto_flush
=> false,
:field_infos
=> ActsAsFerret::field_infos(models),
:create
=> true))
index.batch_size = aaf_configuration[:reindex_batch_size]
index.logger = logger
index.index_models models
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs