Dynamic Data > (Advanced) PHP Function Return value Function Name = get_search_queryFunction Arguments = True
You can also give condition using the above string