Example usage for com.liferay.portal.kernel.search.filter BooleanFilter addRangeTerm

List of usage examples for com.liferay.portal.kernel.search.filter BooleanFilter addRangeTerm

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.search.filter BooleanFilter addRangeTerm.

Prototype

public Filter addRangeTerm(String field, String startValue, String endValue) 

Source Link

Usage

From source file:com.liferay.message.boards.internal.search.MBThreadIndexer.java

License:Open Source License

@Override
public void postProcessContextBooleanFilter(BooleanFilter contextBooleanFilter, SearchContext searchContext)
        throws Exception {

    addStatus(contextBooleanFilter, searchContext);

    boolean discussion = GetterUtil.getBoolean(searchContext.getAttribute("discussion"));

    contextBooleanFilter.addRequiredTerm("discussion", discussion);

    long endDate = GetterUtil.getLong(searchContext.getAttribute("endDate"));
    long startDate = GetterUtil.getLong(searchContext.getAttribute("startDate"));

    if ((endDate > 0) && (startDate > 0)) {
        contextBooleanFilter.addRangeTerm("lastPostDate", startDate, endDate);
    }//from www.  ja va  2  s .  com

    long participantUserId = GetterUtil.getLong(searchContext.getAttribute("participantUserId"));

    if (participantUserId > 0) {
        contextBooleanFilter.addRequiredTerm("participantUserIds", participantUserId);
    }
}