Example usage for com.liferay.portal.kernel.search SearchContext setIncludeStagingGroups

List of usage examples for com.liferay.portal.kernel.search SearchContext setIncludeStagingGroups

Introduction

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

Prototype

public void setIncludeStagingGroups(boolean includeStagingGroups) 

Source Link

Usage

From source file:com.liferay.calendar.web.internal.portlet.CalendarPortlet.java

License:Open Source License

protected Hits search(ThemeDisplay themeDisplay, String keywords) throws Exception {

    SearchContext searchContext = new SearchContext();

    keywords = StringUtil.toLowerCase(keywords);

    searchContext.setAttribute(Field.NAME, keywords);
    searchContext.setAttribute("resourceName", keywords);

    searchContext.setCompanyId(themeDisplay.getCompanyId());
    searchContext.setEnd(SearchContainer.DEFAULT_DELTA);
    searchContext.setGroupIds(new long[0]);

    Group group = themeDisplay.getScopeGroup();

    searchContext.setIncludeStagingGroups(group.isStagingGroup());

    searchContext.setStart(0);//from   w w  w  . j a va  2s. c o  m
    searchContext.setUserId(themeDisplay.getUserId());

    Indexer<?> indexer = CalendarSearcher.getInstance();

    return indexer.search(searchContext);
}