I can see why you're doing this, but it feels very fragile (especially without a functional test).  Could we perhaps store the original search query in `setup_search_options` before it's modified and then check this, instead of working backwards from the where_values?

For example, wouldn't a non-admin user or one using taxonomies cause extra where conditions to be added, triggering (3) instead of (1)?