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 =
logger.debug “rebuild index: #{models.inspect}”
index =[:ferret].dup.update(:auto_flush
=> false,
=> ActsAsFerret::field_infos(models),
=> true))
index.batch_size = aaf_configuration[:reindex_batch_size]
index.logger = logger
index.index_models models