added type casts to search, to fix postgres errors