index optimization takes place before the on_stop_indexing call