Search in sources :

Example 1 with QueryConfig

use of com.liferay.portal.kernel.search.QueryConfig in project liferay-ide by liferay.

the class UserLocalServiceImpl method search.

protected Hits search(long companyId, String firstName, String middleName, String lastName, String fullName, String screenName, String emailAddress, String street, String city, String zip, String region, String country, int status, LinkedHashMap<String, Object> params, boolean andSearch, int start, int end, Sort sort) throws SystemException {
    try {
        SearchContext searchContext = new SearchContext();
        searchContext.setAndSearch(andSearch);
        Map<String, Serializable> attributes = new HashMap<String, Serializable>();
        attributes.put("city", city);
        attributes.put("country", country);
        attributes.put("emailAddress", emailAddress);
        attributes.put("firstName", firstName);
        attributes.put("fullName", fullName);
        attributes.put("lastName", lastName);
        attributes.put("middleName", middleName);
        attributes.put("params", params);
        attributes.put("region", region);
        attributes.put("screenName", screenName);
        attributes.put("street", street);
        attributes.put("status", status);
        attributes.put("zip", zip);
        searchContext.setAttributes(attributes);
        searchContext.setCompanyId(companyId);
        searchContext.setEnd(end);
        if (params != null) {
            String keywords = (String) params.remove("keywords");
            if (Validator.isNotNull(keywords)) {
                searchContext.setKeywords(keywords);
            }
        }
        QueryConfig queryConfig = new QueryConfig();
        queryConfig.setHighlightEnabled(false);
        queryConfig.setScoreEnabled(false);
        searchContext.setQueryConfig(queryConfig);
        if (sort != null) {
            searchContext.setSorts(sort);
        }
        searchContext.setStart(start);
        Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(User.class);
        return indexer.search(searchContext);
    } catch (Exception e) {
        throw new SystemException(e);
    }
}
Also used : Serializable(java.io.Serializable) QueryConfig(com.liferay.portal.kernel.search.QueryConfig) Indexer(com.liferay.portal.kernel.search.Indexer) SystemException(com.liferay.portal.kernel.exception.SystemException) LinkedHashMap(java.util.LinkedHashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) SearchContext(com.liferay.portal.kernel.search.SearchContext) ContactFirstNameException(com.liferay.portal.ContactFirstNameException) ModelListenerException(com.liferay.portal.ModelListenerException) NoSuchImageException(com.liferay.portal.NoSuchImageException) GroupFriendlyURLException(com.liferay.portal.GroupFriendlyURLException) DuplicateOpenIdException(com.liferay.portal.DuplicateOpenIdException) ImageSizeException(com.liferay.portlet.documentlibrary.ImageSizeException) PasswordExpiredException(com.liferay.portal.PasswordExpiredException) UserPasswordException(com.liferay.portal.UserPasswordException) NoSuchUserException(com.liferay.portal.NoSuchUserException) UserSmsException(com.liferay.portal.UserSmsException) NoSuchRoleException(com.liferay.portal.NoSuchRoleException) PortalException(com.liferay.portal.kernel.exception.PortalException) UserIdException(com.liferay.portal.UserIdException) UserPortraitTypeException(com.liferay.portal.UserPortraitTypeException) RequiredUserException(com.liferay.portal.RequiredUserException) ReservedUserScreenNameException(com.liferay.portal.ReservedUserScreenNameException) IOException(java.io.IOException) ContactBirthdayException(com.liferay.portal.ContactBirthdayException) UserReminderQueryException(com.liferay.portal.UserReminderQueryException) DuplicateUserScreenNameException(com.liferay.portal.DuplicateUserScreenNameException) UserEmailAddressException(com.liferay.portal.UserEmailAddressException) ContactFullNameException(com.liferay.portal.ContactFullNameException) EncryptorException(com.liferay.util.EncryptorException) CompanyMaxUsersException(com.liferay.portal.CompanyMaxUsersException) NoSuchTicketException(com.liferay.portal.NoSuchTicketException) UserScreenNameException(com.liferay.portal.UserScreenNameException) ContactLastNameException(com.liferay.portal.ContactLastNameException) ReservedUserEmailAddressException(com.liferay.portal.ReservedUserEmailAddressException) DuplicateUserEmailAddressException(com.liferay.portal.DuplicateUserEmailAddressException) NoSuchUserGroupException(com.liferay.portal.NoSuchUserGroupException) PrincipalException(com.liferay.portal.security.auth.PrincipalException) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchOrganizationException(com.liferay.portal.NoSuchOrganizationException) UserLockoutException(com.liferay.portal.UserLockoutException) UserPortraitSizeException(com.liferay.portal.UserPortraitSizeException)

Aggregations

CompanyMaxUsersException (com.liferay.portal.CompanyMaxUsersException)1 ContactBirthdayException (com.liferay.portal.ContactBirthdayException)1 ContactFirstNameException (com.liferay.portal.ContactFirstNameException)1 ContactFullNameException (com.liferay.portal.ContactFullNameException)1 ContactLastNameException (com.liferay.portal.ContactLastNameException)1 DuplicateOpenIdException (com.liferay.portal.DuplicateOpenIdException)1 DuplicateUserEmailAddressException (com.liferay.portal.DuplicateUserEmailAddressException)1 DuplicateUserScreenNameException (com.liferay.portal.DuplicateUserScreenNameException)1 GroupFriendlyURLException (com.liferay.portal.GroupFriendlyURLException)1 ModelListenerException (com.liferay.portal.ModelListenerException)1 NoSuchImageException (com.liferay.portal.NoSuchImageException)1 NoSuchOrganizationException (com.liferay.portal.NoSuchOrganizationException)1 NoSuchRoleException (com.liferay.portal.NoSuchRoleException)1 NoSuchTicketException (com.liferay.portal.NoSuchTicketException)1 NoSuchUserException (com.liferay.portal.NoSuchUserException)1 NoSuchUserGroupException (com.liferay.portal.NoSuchUserGroupException)1 PasswordExpiredException (com.liferay.portal.PasswordExpiredException)1 RequiredUserException (com.liferay.portal.RequiredUserException)1 ReservedUserEmailAddressException (com.liferay.portal.ReservedUserEmailAddressException)1 ReservedUserScreenNameException (com.liferay.portal.ReservedUserScreenNameException)1