Example usage for com.liferay.portal.kernel.search Summary Summary

List of usage examples for com.liferay.portal.kernel.search Summary Summary

Introduction

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

Prototype

public Summary(String title, String content) 

Source Link

Usage

From source file:com.liferay.blade.samples.modelsummarycontributor.ModelSummaryContributor.java

License:Apache License

private Summary _createSummary(Document document) {
    String prefix = Field.SNIPPET + StringPool.UNDERLINE;

    String title = document.get(prefix + Field.TITLE, Field.TITLE);

    String company = document.get(prefix + Field.COMPANY_ID, Field.COMPANY_ID);

    return new Summary(title, company);
}

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

License:Open Source License

private Summary createSummary(Document document) {
    String prefix = Field.SNIPPET + StringPool.UNDERLINE;

    String title = document.get(prefix + Field.TITLE, Field.CONTENT);
    String content = document.get(prefix + Field.CONTENT, Field.CONTENT);

    return new Summary(title, content);
}

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

License:Open Source License

private Summary createSummary(Document document) {
    String prefix = Field.SNIPPET + StringPool.UNDERLINE;

    String title = document.get(prefix + Field.TITLE, Field.TITLE);

    return new Summary(title, StringPool.BLANK);
}

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

License:Open Source License

@Override
protected Summary doGetSummary(Document document, Locale locale, String snippet, PortletRequest portletRequest,
        PortletResponse portletResponse) {

    String title = document.get(Field.TITLE);

    String content = snippet;/*  w  w  w  .  j a v a 2 s  .  c  om*/

    if (Validator.isNull(snippet)) {
        content = document.get(Field.DESCRIPTION);

        if (Validator.isNull(content)) {
            content = StringUtil.shorten(document.get(Field.CONTENT), 200);
        }
    }

    String resourcePrimKey = document.get(Field.ENTRY_CLASS_PK);

    return new Summary(title, content);
}

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

License:Open Source License

@Override
public void addRelatedModel(SearchResult searchResult, Document document, Locale locale,
        PortletRequest portletRequest, PortletResponse portletResponse) throws PortalException {

    long entryClassPK = GetterUtil.getLong(document.get(Field.ENTRY_CLASS_PK));

    MBMessage mbMessage = _mbMessageLocalService.getMessage(entryClassPK);

    Comment comment = _commentManager.fetchComment(mbMessage.getMessageId());

    Summary summary = new Summary(null, mbMessage.getBody());

    summary.setEscape(false);//from   w ww.  j  av  a  2s  .co  m

    searchResult.addComment(comment, summary);
}

From source file:com.liferay.user.groups.admin.web.internal.search.UserGroupIndexer.java

License:Open Source License

@Override
protected Summary doGetSummary(Document document, Locale locale, String snippet, PortletRequest portletRequest,
        PortletResponse portletResponse) {

    String title = document.get("name");

    String content = null;//w  w w .j  a  v  a2  s.co  m

    return new Summary(title, content);
}