code: protected List<IPersonAttributes> searchDirectory(String query, PortletRequest request) {
          final Map<String, Object> queryAttributes = new HashMap<>();
          for (String attr : directoryQueryAttributes) {
              queryAttributes.put(attr, query);
          }
  
          final List<IPersonAttributes> people;
  
          // get an authorization principal for the current requesting user
          HttpServletRequest servletRequest = portalRequestUtils.getPortletHttpRequest(request);
          IPerson currentUser = personManager.getPerson(servletRequest);
  
          // get the set of people matching the search query
          people = this.lookupHelper.searchForPeople(currentUser, queryAttributes);
  
          log.debug(
                  "Directory portlet search outcome:\n\tqueryAttributes="
                          + queryAttributes
                          + "\n\tsearchResult="
                          + people);
  
          return people;
      }
docs: Search the directory for people matching the search query. Search results will be scoped to
  the permissions of the user performing the search.
  
  @param query
  @param request
  @return