fix indexing issue, add test for search controller