Example usage for com.liferay.portal.kernel.search QueryConfig setSelectedFieldNames

List of usage examples for com.liferay.portal.kernel.search QueryConfig setSelectedFieldNames

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.search QueryConfig setSelectedFieldNames.

Prototype

public void setSelectedFieldNames(String... selectedFieldNames) 

Source Link

Usage

From source file:com.liferay.calendar.search.test.CalendarSearchFixture.java

License:Open Source License

public SearchContext getSearchContext(String keywords, Locale locale) {
    SearchContext searchContext = new SearchContext();

    try {//from   w  ww .j  a  va 2s  . c  o  m
        searchContext.setCompanyId(TestPropsValues.getCompanyId());
        searchContext.setUserId(getUserId());
    } catch (PortalException pe) {
        throw new RuntimeException(pe);
    }

    searchContext.setGroupIds(new long[] { _group.getGroupId() });
    searchContext.setKeywords(keywords);
    searchContext.setLocale(Objects.requireNonNull(locale));

    QueryConfig queryConfig = searchContext.getQueryConfig();

    queryConfig.setSelectedFieldNames(StringPool.STAR);

    return searchContext;
}

From source file:com.liferay.document.library.search.test.DLFileEntryIndexerLocalizedContentTest.java

License:Open Source License

private SearchContext _getSearchContext(String searchTerm, Locale locale, long groupId) throws Exception {

    SearchContext searchContext = SearchContextTestUtil.getSearchContext(groupId);

    searchContext.setKeywords(searchTerm);
    searchContext.setLocale(locale);//from w  ww . j av  a2 s. com

    QueryConfig queryConfig = searchContext.getQueryConfig();

    queryConfig.setSelectedFieldNames(StringPool.STAR);

    return searchContext;
}

From source file:com.liferay.journal.search.test.JournalArticleIndexerLocalizedContentTest.java

License:Open Source License

private SearchContext _getSearchContext(String searchTerm, Locale locale) throws Exception {

    SearchContext searchContext = SearchContextTestUtil.getSearchContext(_group.getGroupId());

    searchContext.setKeywords(searchTerm);

    searchContext.setLocale(locale);//from   ww w .  j av a 2 s .  co m

    QueryConfig queryConfig = searchContext.getQueryConfig();

    queryConfig.setSelectedFieldNames(StringPool.STAR);

    return searchContext;
}

From source file:com.liferay.users.admin.indexer.test.OrganizationIndexerTest.java

License:Open Source License

protected Hits search(String keywords) throws Exception {
    SearchContext searchContext = new SearchContext();

    searchContext.setCompanyId(TestPropsValues.getCompanyId());
    searchContext.setEntryClassNames(new String[] { Organization.class.getName() });
    searchContext.setKeywords(keywords);

    QueryConfig queryConfig = searchContext.getQueryConfig();

    queryConfig.setSelectedFieldNames(Field.NAME);

    return _indexer.search(searchContext);
}