This is a small nit, but an alternative to using null would be to use the empty string (or an appropriately named constant), or some other string to indicate all results.  This would clean up the test for nulls, and may streamline the actual search (i.e. if all queries were valid, including "no query", you wouldn't need any special cases for no query).  This is not a showstopper, more just a suggestion for any future changes.