Example usage for com.liferay.portal.kernel.search Field TITLE

List of usage examples for com.liferay.portal.kernel.search Field TITLE

Introduction

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

Prototype

String TITLE

To view the source code for com.liferay.portal.kernel.search Field TITLE.

Click Source Link

Usage

From source file:com.liferay.asset.categories.internal.search.AssetCategoryIndexer.java

License:Open Source License

@Override
protected Document doGetDocument(AssetCategory assetCategory) throws Exception {

    if (_log.isDebugEnabled()) {
        _log.debug("Indexing asset category " + assetCategory);
    }/*w w w.j  a  v a 2 s. c o  m*/

    Document document = getBaseModelDocument(CLASS_NAME, assetCategory);

    document.addKeyword(Field.ASSET_CATEGORY_ID, assetCategory.getCategoryId());

    List<AssetCategory> categories = new ArrayList<>(1);

    categories.add(assetCategory);

    addSearchAssetCategoryTitles(document, Field.ASSET_CATEGORY_TITLE, categories);

    document.addKeyword(Field.ASSET_PARENT_CATEGORY_ID, assetCategory.getParentCategoryId());
    document.addKeyword(Field.ASSET_VOCABULARY_ID, assetCategory.getVocabularyId());

    Locale siteDefaultLocale = _portal.getSiteDefaultLocale(assetCategory.getGroupId());

    addLocalizedField(document, Field.DESCRIPTION, siteDefaultLocale, assetCategory.getDescriptionMap());

    document.addText(Field.NAME, assetCategory.getName());
    addLocalizedField(document, Field.TITLE, siteDefaultLocale, assetCategory.getTitleMap());
    document.addKeyword("leftCategoryId", assetCategory.getLeftCategoryId());

    if (_log.isDebugEnabled()) {
        _log.debug("Document " + assetCategory + " indexed successfully");
    }

    return document;
}

From source file:com.liferay.asset.categories.internal.search.AssetVocabularyIndexer.java

License:Open Source License

@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
        SearchContext searchContext) throws Exception {

    String title = (String) searchContext.getAttribute(Field.TITLE);

    if (Validator.isNotNull(title)) {
        BooleanQuery localizedQuery = new BooleanQueryImpl();

        addSearchLocalizedTerm(localizedQuery, searchContext, Field.TITLE, true);

        searchQuery.add(localizedQuery, BooleanClauseOccur.SHOULD);
    }/*from  ww w.  j a va2 s  . c o  m*/
}

From source file:com.liferay.asset.categories.internal.search.AssetVocabularyIndexer.java

License:Open Source License

@Override
protected Document doGetDocument(AssetVocabulary assetVocabulary) throws Exception {

    if (_log.isDebugEnabled()) {
        _log.debug("Indexing asset vocabulary " + assetVocabulary);
    }/*from   ww  w  . ja  va  2  s  . c  om*/

    Document document = getBaseModelDocument(CLASS_NAME, assetVocabulary);

    document.addKeyword(Field.ASSET_VOCABULARY_ID, assetVocabulary.getVocabularyId());

    Locale siteDefaultLocale = _portal.getSiteDefaultLocale(assetVocabulary.getGroupId());

    addLocalizedField(document, Field.DESCRIPTION, siteDefaultLocale, assetVocabulary.getDescriptionMap());

    document.addText(Field.NAME, assetVocabulary.getName());
    addLocalizedField(document, Field.TITLE, siteDefaultLocale, assetVocabulary.getTitleMap());

    if (_log.isDebugEnabled()) {
        _log.debug("Document " + assetVocabulary + " indexed successfully");
    }

    return document;
}

From source file:com.liferay.asset.internal.search.AssetEntryIndexer.java

License:Open Source License

@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
        SearchContext searchContext) throws Exception {

    if (searchContext.getAttributes() == null) {
        return;//from  w w  w .  j  av  a2s .  c  o  m
    }

    addSearchTerm(searchQuery, searchContext, Field.DESCRIPTION, false);
    addSearchTerm(searchQuery, searchContext, Field.TITLE, false);
    addSearchTerm(searchQuery, searchContext, Field.USER_NAME, false);
}

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.blogs.internal.search.BlogsEntryIndexer.java

License:Open Source License

public BlogsEntryIndexer() {
    setDefaultSelectedFieldNames(Field.ASSET_TAG_NAMES, Field.COMPANY_ID, Field.CONTENT, Field.ENTRY_CLASS_NAME,
            Field.ENTRY_CLASS_PK, Field.GROUP_ID, Field.MODIFIED_DATE, Field.SCOPE_GROUP_ID, Field.TITLE,
            Field.UID);//from w  ww .j a  va2  s .com
    setFilterSearch(true);
    setPermissionAware(true);
}

From source file:com.liferay.blogs.internal.search.BlogsEntryIndexer.java

License:Open Source License

@Override
protected Document doGetDocument(BlogsEntry blogsEntry) throws Exception {
    Document document = getBaseModelDocument(CLASS_NAME, blogsEntry);

    document.addText(Field.CAPTION, blogsEntry.getCoverImageCaption());
    document.addText(Field.CONTENT, HtmlUtil.extractText(blogsEntry.getContent()));
    document.addText(Field.DESCRIPTION, blogsEntry.getDescription());
    document.addDate(Field.MODIFIED_DATE, blogsEntry.getModifiedDate());
    document.addText(Field.SUBTITLE, blogsEntry.getSubtitle());
    document.addText(Field.TITLE, blogsEntry.getTitle());

    return document;
}

From source file:com.liferay.bookmarks.search.BookmarksEntryIndexer.java

License:Open Source License

public BookmarksEntryIndexer() {
    setDefaultSelectedFieldNames(Field.ASSET_TAG_NAMES, Field.COMPANY_ID, Field.ENTRY_CLASS_NAME,
            Field.ENTRY_CLASS_PK, Field.GROUP_ID, Field.MODIFIED_DATE, Field.SCOPE_GROUP_ID, Field.TITLE,
            Field.UID, Field.URL);
    setFilterSearch(true);/*from  w w w.ja v a2s  . c  o m*/
    setPermissionAware(true);
}

From source file:com.liferay.bookmarks.search.BookmarksEntryIndexer.java

License:Open Source License

@Override
protected Document doGetDocument(BookmarksEntry bookmarksEntry) throws Exception {

    Document document = getBaseModelDocument(CLASS_NAME, bookmarksEntry);

    document.addText(Field.DESCRIPTION, bookmarksEntry.getDescription());
    document.addKeyword(Field.FOLDER_ID, bookmarksEntry.getFolderId());
    document.addText(Field.TITLE, bookmarksEntry.getName());
    document.addKeyword(Field.TREE_PATH, StringUtil.split(bookmarksEntry.getTreePath(), CharPool.SLASH));
    document.addText(Field.URL, bookmarksEntry.getUrl());

    return document;
}

From source file:com.liferay.bookmarks.search.BookmarksEntryIndexer.java

License:Open Source License

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

    Summary summary = createSummary(document, Field.TITLE, Field.URL);

    return summary;
}