Renames indexer function
Improves indexer function

* Enforces to commit changes after the last document.