search.lua: minor simplification and remove unused variable