Maybe just set `action = index if action == 'auto_complete_search'` so we use the existing code path below (including gsub etc)?