refactor getSearchResultsTotal in two separate methods