Modified DB query to implement all search.