Fixing bugs in search index rebuild.