List of usage examples for com.liferay.portal.kernel.search Field CONTENT
String CONTENT
To view the source code for com.liferay.portal.kernel.search Field CONTENT.
Click Source Link
From source file:com.liferay.journal.search.test.JournalArticleIndexerSummaryTest.java
License:Open Source License
protected void setFields(String title, String content, Document document) { document.addText(getFieldName(Field.CONTENT), content); document.addText(getFieldName(Field.TITLE), title); }
From source file:com.liferay.journal.search.test.JournalArticleIndexerSummaryTest.java
License:Open Source License
protected void setSnippets(String highlightedTitle, String highlightedContent, Document document) { document.addText(getSnippetFieldName(Field.CONTENT), highlightedContent); document.addText(getSnippetFieldName(Field.TITLE), highlightedTitle); }
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) {/* w w w . j ava 2 s . co 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; }
From source file:com.liferay.journal.web.internal.display.context.JournalDisplayContext.java
License:Open Source License
protected SearchContext buildSearchContext(long companyId, long groupId, List<java.lang.Long> folderIds, long classNameId, String ddmStructureKey, String ddmTemplateKey, String keywords, LinkedHashMap<String, Object> params, int start, int end, Sort sort, boolean showVersions) { String articleId = null;/*from w w w. jav a 2s . c om*/ String title = null; String description = null; String content = null; boolean andOperator = false; if (Validator.isNotNull(keywords)) { articleId = keywords; title = keywords; description = keywords; content = keywords; } else { andOperator = true; } if (params != null) { params.put("keywords", keywords); } SearchContext searchContext = new SearchContext(); searchContext.setAndSearch(andOperator); 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, getStatus()); 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 }); searchContext.setIncludeDiscussions(GetterUtil.getBoolean(params.get("includeDiscussions"), true)); if (params != null) { keywords = (String) params.remove("keywords"); if (Validator.isNotNull(keywords)) { searchContext.setKeywords(keywords); } } searchContext.setAttribute("head", !showVersions); searchContext.setAttribute("params", params); searchContext.setEnd(end); searchContext.setFolderIds(folderIds); searchContext.setStart(start); QueryConfig queryConfig = new QueryConfig(); queryConfig.setHighlightEnabled(false); queryConfig.setScoreEnabled(false); searchContext.setQueryConfig(queryConfig); if (sort != null) { searchContext.setSorts(sort); } searchContext.setStart(start); return searchContext; }
From source file:com.liferay.journal.web.internal.search.JournalSearcher.java
License:Open Source License
public JournalSearcher() { setDefaultSelectedFieldNames(Field.ARTICLE_ID, Field.COMPANY_ID, Field.DEFAULT_LANGUAGE_ID, Field.ENTRY_CLASS_NAME, Field.ENTRY_CLASS_PK, Field.GROUP_ID, Field.VERSION, Field.UID); setDefaultSelectedLocalizedFieldNames(Field.CONTENT, Field.DESCRIPTION, Field.TITLE); setFilterSearch(true);//w w w . j a va2 s. com setPermissionAware(true); setSelectAllLocales(true); }
From source file:com.liferay.knowledgebase.admin.util.AdminIndexer.java
License:Open Source License
public AdminIndexer() { setDefaultSelectedFieldNames(Field.COMPANY_ID, Field.CONTENT, Field.CREATE_DATE, Field.DESCRIPTION, Field.ENTRY_CLASS_NAME, Field.ENTRY_CLASS_PK, Field.MODIFIED_DATE, Field.TITLE, Field.UID, Field.USER_NAME);//w ww. jav a2 s .c om setFilterSearch(true); setPermissionAware(true); }
From source file:com.liferay.knowledgebase.admin.util.AdminIndexer.java
License:Open Source License
@Override public void postProcessSearchQuery(BooleanQuery searchQuery, SearchContext searchContext) throws Exception { addSearchTerm(searchQuery, searchContext, Field.CONTENT, true); addSearchTerm(searchQuery, searchContext, Field.DESCRIPTION, true); addSearchTerm(searchQuery, searchContext, Field.TITLE, true); addSearchTerm(searchQuery, searchContext, Field.USER_NAME, true); }
From source file:com.liferay.knowledgebase.admin.util.AdminIndexer.java
License:Open Source License
@Override protected Document doGetDocument(Object obj) throws Exception { KBArticle kbArticle = (KBArticle) obj; Document document = getBaseModelDocument(PORTLET_ID, kbArticle); document.addText(Field.CONTENT, HtmlUtil.extractText(kbArticle.getContent())); document.addText(Field.DESCRIPTION, kbArticle.getDescription()); document.addText(Field.TITLE, kbArticle.getTitle()); document.addKeyword("titleKeyword", kbArticle.getTitle(), true); return document; }
From source file:com.liferay.knowledgebase.admin.util.AdminIndexer.java
License:Open Source License
@Override protected Summary doGetSummary(Document document, Locale locale, String snippet, PortletURL portletURL, PortletRequest portletRequest, PortletResponse portletResponse) { String title = document.get(Field.TITLE); String content = snippet;/*from w ww. jav a 2s . co m*/ 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); portletURL.setParameter("mvcPath", "/admin/view_article.jsp"); portletURL.setParameter("resourcePrimKey", resourcePrimKey); return new Summary(title, content, portletURL); }
From source file:com.liferay.knowledgebase.admin.util.KBArticleIndexer.java
License:Open Source License
public KBArticleIndexer() { setDefaultSelectedFieldNames(Field.COMPANY_ID, Field.CONTENT, Field.CREATE_DATE, Field.DESCRIPTION, Field.ENTRY_CLASS_NAME, Field.ENTRY_CLASS_PK, Field.MODIFIED_DATE, Field.TITLE, Field.UID, Field.USER_NAME);/*w ww.j a v a 2 s. co m*/ setFilterSearch(true); setPermissionAware(true); }