Example usage for com.liferay.portal.search.batch BatchIndexingActionable setCompanyId

List of usage examples for com.liferay.portal.search.batch BatchIndexingActionable setCompanyId

Introduction

In this page you can find the example usage for com.liferay.portal.search.batch BatchIndexingActionable setCompanyId.

Prototype

public void setCompanyId(long companyId);

Source Link

Usage

From source file:com.liferay.docs.guestbook.search.GuestbookEntryBatchReindexerImpl.java

License:Open Source License

@Override
public void reindex(long guestbookId, long companyId) {
    BatchIndexingActionable batchIndexingActionable = indexerWriter.getBatchIndexingActionable();

    batchIndexingActionable.setAddCriteriaMethod(dynamicQuery -> {
        Property guestbookIdPropery = PropertyFactoryUtil.forName("guestbookId");

        dynamicQuery.add(guestbookIdPropery.eq(guestbookId));
    });/*from   w ww .  ja  v a2  s .  co  m*/

    batchIndexingActionable.setCompanyId(companyId);

    batchIndexingActionable.setPerformActionMethod((GuestbookEntry entry) -> {
        Document document = indexerDocumentBuilder.getDocument(entry);

        batchIndexingActionable.addDocuments(document);
    });

    batchIndexingActionable.performActions();

}