Rework indexing engine.
Merge with master and fix reproducibility of tests.