Example usage for com.liferay.portal.kernel.search IndexWriterHelperUtil updateDocuments

List of usage examples for com.liferay.portal.kernel.search IndexWriterHelperUtil updateDocuments

Introduction

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

Prototype

public static void updateDocuments(String searchEngineId, long companyId, Collection<Document> documents,
            boolean commitImmediately) throws SearchException 

Source Link

Usage

From source file:com.liferay.knowledgebase.admin.util.KBArticleIndexer.java

License:Open Source License

protected void reindexKBArticles(KBArticle kbArticle) throws Exception {

    // See KBArticlePermission#contains

    List<KBArticle> kbArticles = KBArticleLocalServiceUtil.getKBArticleAndAllDescendantKBArticles(
            kbArticle.getResourcePrimKey(), WorkflowConstants.STATUS_APPROVED, null);

    Collection<Document> documents = new ArrayList<>();

    for (KBArticle curKBArticle : kbArticles) {
        documents.add(getDocument(curKBArticle));
    }//from w w w .  j a  va2 s .  com

    IndexWriterHelperUtil.updateDocuments(getSearchEngineId(), kbArticle.getCompanyId(), documents,
            isCommitImmediately());
}