Prevent 500 ScopedSearch errors on the API

Views that use counters from the search filter

Filter to fix 500 errors with ScopedSearch

This filter is applied on every controller, around the index action.
It's functionality is basically to avoid 500 errors caused by broken
ScopedSearch queries, for instance "wrongfield = dlkas".

Filter around index to avoid 500 on scopedsearch

Search test for around_filter on index

Typo on scoped search error handler

Use Hostgroup.my_groups when User is admin

Simpler implementation of search error handler

Fix tests to test redirect_to back

Remove unnecessary scoped_search error UI handler