don't create duplicate index entries
#WEB-13676 fixed
(cherry picked from commit 843c0c6, r = Maxim Mossienko)
review cleanup
(cherry picked from commit e0cce18, r = Maxim Mossienko)