Move search space to where clause