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

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

Introduction

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

Prototype

String DESCRIPTION

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

Click Source Link

Usage

From source file:com.liferay.dynamic.data.mapping.internal.search.DDMFormInstanceRecordIndexer.java

License:Open Source License

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

    long ddmFormInstanceId = GetterUtil.getLong(document.get("formInstanceId"));

    String title = getTitle(ddmFormInstanceId, locale);

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

    summary.setMaxContentLength(200);//from www .  j a  v  a2  s.  c o  m
    summary.setTitle(title);

    return summary;
}

From source file:com.liferay.exportimport.search.ExportImportConfigurationIndexer.java

License:Open Source License

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

    addSearchTerm(searchQuery, searchContext, Field.DESCRIPTION, false);
    addSearchTerm(searchQuery, searchContext, "exportImportConfigurationId", false);
    addSearchTerm(searchQuery, searchContext, Field.NAME, false);
}

From source file:com.liferay.exportimport.search.ExportImportConfigurationIndexer.java

License:Open Source License

@Override
protected Document doGetDocument(ExportImportConfiguration exportImportConfiguration) throws Exception {

    Document document = getBaseModelDocument(CLASS_NAME, exportImportConfiguration);

    document.addText(Field.DESCRIPTION, exportImportConfiguration.getDescription());
    document.addText(Field.NAME, exportImportConfiguration.getName());
    document.addKeyword(Field.TYPE, exportImportConfiguration.getType());
    document.addNumber("exportImportConfigurationId",
            exportImportConfiguration.getExportImportConfigurationId());

    Map<String, Serializable> settingsMap = exportImportConfiguration.getSettingsMap();

    populateDates(document, settingsMap);
    populateLayoutIds(document, settingsMap);
    populateLocale(document, settingsMap);
    populateParameterMap(document, settingsMap);
    populateSiteInformation(document, settingsMap);
    populateTimeZone(document, settingsMap);

    document.addKeyword(_PREFIX_SETTING + Field.USER_ID, MapUtil.getLong(settingsMap, "userId"));

    return document;
}

From source file:com.liferay.exportimport.search.ExportImportConfigurationIndexer.java

License:Open Source License

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

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

    return summary;
}

From source file:com.liferay.journal.search.JournalArticleIndexer.java

License:Open Source License

public JournalArticleIndexer() {
    setDefaultSelectedFieldNames(Field.ASSET_TAG_NAMES, Field.ARTICLE_ID, Field.COMPANY_ID,
            Field.DEFAULT_LANGUAGE_ID, Field.ENTRY_CLASS_NAME, Field.ENTRY_CLASS_PK, Field.GROUP_ID,
            Field.MODIFIED_DATE, Field.SCOPE_GROUP_ID, Field.VERSION, Field.UID);
    setDefaultSelectedLocalizedFieldNames(Field.CONTENT, Field.DESCRIPTION, Field.TITLE);
    setFilterSearch(true);//from   ww w  . j ava  2 s.  com
    setPermissionAware(true);
    setSelectAllLocales(true);
}

From source file:com.liferay.journal.search.JournalArticleIndexer.java

License:Open Source License

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

    addSearchTerm(searchQuery, searchContext, Field.ARTICLE_ID, false);
    addSearchTerm(searchQuery, searchContext, Field.CLASS_PK, false);
    addSearchLocalizedTerm(searchQuery, searchContext, Field.CONTENT, false);
    addSearchLocalizedTerm(searchQuery, searchContext, Field.DESCRIPTION, false);
    addSearchTerm(searchQuery, searchContext, Field.ENTRY_CLASS_PK, false);
    addSearchLocalizedTerm(searchQuery, searchContext, Field.TITLE, false);
    addSearchTerm(searchQuery, searchContext, Field.USER_NAME, false);

    LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");

    if (params != null) {
        String expandoAttributes = (String) params.get("expandoAttributes");

        if (Validator.isNotNull(expandoAttributes)) {
            addSearchExpando(searchQuery, searchContext, expandoAttributes);
        }//ww w .j  a  va  2 s.com
    }
}

From source file:com.liferay.journal.search.JournalArticleIndexer.java

License:Open Source License

@Override
protected Document doGetDocument(JournalArticle journalArticle) throws Exception {

    Document document = getBaseModelDocument(CLASS_NAME, journalArticle);

    long classPK = journalArticle.getId();

    if (!isIndexAllArticleVersions()) {
        classPK = journalArticle.getResourcePrimKey();
    }//from  w ww.  j  av  a2s . c om

    document.addUID(CLASS_NAME, classPK);

    String articleDefaultLanguageId = LocalizationUtil.getDefaultLanguageId(journalArticle.getDocument());

    String[] languageIds = LocalizationUtil.getAvailableLanguageIds(journalArticle.getDocument());

    for (String languageId : languageIds) {
        String content = extractDDMContent(journalArticle, languageId);

        String description = journalArticle.getDescription(languageId);

        String title = journalArticle.getTitle(languageId);

        if (languageId.equals(articleDefaultLanguageId)) {
            document.addText(Field.CONTENT, content);
            document.addText(Field.DESCRIPTION, description);
            document.addText("defaultLanguageId", languageId);
        }

        document.addText(LocalizationUtil.getLocalizedName(Field.CONTENT, languageId), content);
        document.addText(LocalizationUtil.getLocalizedName(Field.DESCRIPTION, languageId), description);
        document.addText(LocalizationUtil.getLocalizedName(Field.TITLE, languageId), title);
    }

    document.addKeyword(Field.FOLDER_ID, journalArticle.getFolderId());

    String articleId = journalArticle.getArticleId();

    if (journalArticle.isInTrash()) {
        articleId = TrashUtil.getOriginalTitle(articleId);
    }

    document.addKeywordSortable(Field.ARTICLE_ID, articleId);

    document.addKeyword(Field.LAYOUT_UUID, journalArticle.getLayoutUuid());
    document.addKeyword(Field.TREE_PATH, StringUtil.split(journalArticle.getTreePath(), CharPool.SLASH));
    document.addKeyword(Field.VERSION, journalArticle.getVersion());

    document.addKeyword("ddmStructureKey", journalArticle.getDDMStructureKey());
    document.addKeyword("ddmTemplateKey", journalArticle.getDDMTemplateKey());
    document.addDate("displayDate", journalArticle.getDisplayDate());
    document.addKeyword("head", JournalUtil.isHead(journalArticle));

    boolean headListable = JournalUtil.isHeadListable(journalArticle);

    document.addKeyword("headListable", headListable);

    // Scheduled listable articles should be visible in asset browser

    if (journalArticle.isScheduled() && headListable) {
        boolean visible = GetterUtil.getBoolean(document.get("visible"));

        if (!visible) {
            document.addKeyword("visible", true);
        }
    }

    addDDMStructureAttributes(document, journalArticle);

    return document;
}

From source file:com.liferay.journal.search.JournalFolderIndexer.java

License:Open Source License

public JournalFolderIndexer() {
    setDefaultSelectedFieldNames(Field.COMPANY_ID, Field.DESCRIPTION, Field.ENTRY_CLASS_NAME,
            Field.ENTRY_CLASS_PK, Field.TITLE, Field.UID);
    setFilterSearch(true);/*from w w w  .ja v a2 s  .  c o m*/
    setPermissionAware(true);
}

From source file:com.liferay.journal.search.JournalFolderIndexer.java

License:Open Source License

@Override
protected Document doGetDocument(JournalFolder journalFolder) throws Exception {

    if (_log.isDebugEnabled()) {
        _log.debug("Indexing journalFolder " + journalFolder);
    }//from w w  w  .  j  ava2  s .  c  o m

    Document document = getBaseModelDocument(CLASS_NAME, journalFolder);

    document.addText(Field.DESCRIPTION, journalFolder.getDescription());
    document.addKeyword(Field.FOLDER_ID, journalFolder.getParentFolderId());

    String title = journalFolder.getName();

    if (journalFolder.isInTrash()) {
        title = TrashUtil.getOriginalTitle(title);
    }

    document.addText(Field.TITLE, title);

    document.addKeyword(Field.TREE_PATH, StringUtil.split(journalFolder.getTreePath(), CharPool.SLASH));

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

    return document;
}

From source file:com.liferay.journal.service.impl.JournalArticleLocalServiceImpl.java

License:Open Source License

protected SearchContext buildSearchContext(long companyId, long groupId, List<Long> folderIds, long classNameId,
        String articleId, String title, String description, String content, int status, String ddmStructureKey,
        String ddmTemplateKey, LinkedHashMap<String, Object> params, boolean andSearch, int start, int end,
        Sort sort) {/*from  ww w  . jav a2s.c  o m*/

    SearchContext searchContext = new SearchContext();

    searchContext.setAndSearch(andSearch);

    Map<String, Serializable> attributes = new HashMap<>();

    attributes.put(Field.ARTICLE_ID, articleId);
    attributes.put(Field.CLASS_NAME_ID, classNameId);
    attributes.put(Field.CONTENT, content);
    attributes.put(Field.DESCRIPTION, description);
    attributes.put(Field.STATUS, status);
    attributes.put(Field.TITLE, title);
    attributes.put("ddmStructureKey", ddmStructureKey);
    attributes.put("ddmTemplateKey", ddmTemplateKey);
    attributes.put("params", params);

    searchContext.setAttributes(attributes);

    searchContext.setCompanyId(companyId);
    searchContext.setEnd(end);
    searchContext.setFolderIds(folderIds);
    searchContext.setGroupIds(new long[] { groupId });

    if (params != null) {
        searchContext.setIncludeDiscussions(GetterUtil.getBoolean(params.get("includeDiscussions")));

        String keywords = (String) params.remove("keywords");

        if (Validator.isNotNull(keywords)) {
            searchContext.setKeywords(keywords);
        }
    }

    QueryConfig queryConfig = new QueryConfig();

    queryConfig.setHighlightEnabled(false);
    queryConfig.setScoreEnabled(false);

    searchContext.setQueryConfig(queryConfig);

    if (sort != null) {
        searchContext.setSorts(sort);
    }

    searchContext.setStart(start);

    return searchContext;
}