fixed bug if search index is empty