List<Long> allowedBranchesIds = this.getDao().getAllowedBranchesIds(currentUser);
if (!StringUtils.isEmpty(phrase) && !allowedBranchesIds.isEmpty()) {
int pageSize = currentUser.getPageSize();
PageRequest pageRequest = new PageRequest(page, pageSize);
// hibernate search refuses to process long string throwing error
String normalizedPhrase = StringUtils.left(phrase, 50);
return searchDao.searchByTitleAndContent(normalizedPhrase, pageRequest, allowedBranchesIds);
}