Example usage for com.liferay.portal.kernel.search Document get

List of usage examples for com.liferay.portal.kernel.search Document get

Introduction

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

Prototype

public String get(Locale locale, String name, String defaultName);

Source Link

Usage

From source file:com.liferay.portlet.journal.util.JournalArticleIndexer.java

License:Open Source License

protected String getBasicContentSummary(Document document, Locale snippetLocale) {

    String prefix = Field.SNIPPET + StringPool.UNDERLINE;

    String content = document.get(snippetLocale, prefix + Field.DESCRIPTION, prefix + Field.CONTENT);

    if (Validator.isBlank(content)) {
        content = document.get(snippetLocale, Field.DESCRIPTION, Field.CONTENT);
    }//from  w  w w. j av  a  2  s  .  co  m

    if (content.length() > 200) {
        content = StringUtil.shorten(content, 200);
    }

    return content;
}