fix a bug where when calling #search on a scope chain with an empty query, the scope chain would be discarded