Search: fixed problems with not queries and improve performance