Example usage for com.liferay.portal.search.summary SummaryBuilder setLocale

List of usage examples for com.liferay.portal.search.summary SummaryBuilder setLocale

Introduction

In this page you can find the example usage for com.liferay.portal.search.summary SummaryBuilder setLocale.

Prototype

public void setLocale(Locale locale);

Source Link

Usage

From source file:com.liferay.journal.content.search.web.internal.display.context.JournalContentSearchDisplayContext.java

License:Open Source License

public Summary getSummary(Document document) throws Exception {
    if (_summary != null) {
        return _summary;
    }//from   www  .  ja va2s .  c  om

    ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY);

    Indexer<JournalArticle> indexer = IndexerRegistryUtil.getIndexer(JournalArticle.class);

    com.liferay.portal.kernel.search.Summary summary = indexer.getSummary(document, StringPool.BLANK,
            _liferayPortletRequest, _liferayPortletResponse);

    SummaryBuilder summaryBuilder = _summaryBuilderFactory.newInstance();

    summaryBuilder.setContent(summary.getContent());
    summaryBuilder.setHighlight(_journalContentSearchPortletInstanceConfiguration.enableHighlighting());
    summaryBuilder.setLocale(themeDisplay.getLocale());
    summaryBuilder.setMaxContentLength(summary.getMaxContentLength());
    summaryBuilder.setTitle(summary.getTitle());

    _summary = summaryBuilder.build();

    return _summary;
}