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:ca.efendi.datafeeds.search.CJProductIndexer.java
License:Apache License
public CJProductIndexer() { 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. ja va 2s . c o m*/ setFilterSearch(true); setPermissionAware(false); }
From source file:ca.efendi.datafeeds.search.CJProductIndexer.java
License:Apache License
@Override protected Document doGetDocument(final CJProduct object) throws Exception { final Document document = getBaseModelDocument(CLASS_NAME, object); document.addText(Field.CAPTION, object.getName()); document.addText(Field.CONTENT, HtmlUtil.extractText(object.getDescription())); document.addText(Field.DESCRIPTION, object.getDescription()); document.addDate(Field.MODIFIED_DATE, object.getModifiedDate()); //document.addText(Field.SUBTITLE, blogsEntry.getSubtitle()); document.addText(Field.TITLE, object.getName()); return document; }
From source file:com.inkwell.internet.slogan.search.SloganIndexer.java
License:Open Source License
public Summary getSummary(Document document, String snippet, PortletURL portletURL) { String title = document.get(Field.TITLE); String content = snippet;//from ww w. j av a2 s . 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("jspPage", "/admin/view_slogan.jsp"); portletURL.setParameter("resourcePrimKey", resourcePrimKey); return new Summary(title, content, portletURL); }
From source file:com.inkwell.internet.slogan.search.SloganIndexer.java
License:Open Source License
@Override protected Document doGetDocument(Object obj) throws Exception { Slogan slogan = (Slogan) obj;//from w w w. jav a 2 s .c o m long companyId = slogan.getCompanyId(); long groupId = getParentGroupId(slogan.getGroupId()); long scopeGroupId = slogan.getGroupId(); long userId = slogan.getUserId(); long resourcePrimKey = slogan.getPrimaryKey(); String title = slogan.getSloganText(); String content = slogan.getSloganText(); String description = slogan.getSloganText(); Date modifiedDate = slogan.getSloganDate(); long[] assetCategoryIds = AssetCategoryLocalServiceUtil.getCategoryIds(Slogan.class.getName(), resourcePrimKey); List<AssetCategory> categories = AssetCategoryLocalServiceUtil.getCategories(Slogan.class.getName(), resourcePrimKey); String[] assetCategoryNames = StringUtil.split(ListUtil.toString(categories, "name")); // EE lets you do this quicker: // String[] assetCategoryNames = // AssetCategoryLocalServiceUtil.getCategoryNames( // Slogan.class.getName(), resourcePrimKey); String[] assetTagNames = AssetTagLocalServiceUtil.getTagNames(Slogan.class.getName(), resourcePrimKey); Document document = new DocumentImpl(); document.addUID(PORTLET_ID, resourcePrimKey); document.addModifiedDate(modifiedDate); document.addKeyword(Field.COMPANY_ID, companyId); document.addKeyword(Field.PORTLET_ID, PORTLET_ID); document.addKeyword(Field.GROUP_ID, groupId); document.addKeyword(Field.SCOPE_GROUP_ID, scopeGroupId); document.addKeyword(Field.USER_ID, userId); document.addText(Field.TITLE, title); document.addText(Field.CONTENT, content); document.addText(Field.DESCRIPTION, description); document.addKeyword(Field.ASSET_CATEGORY_IDS, assetCategoryIds); document.addKeyword("assetCategoryNames", assetCategoryNames); //document.addKeyword(Field.ASSET_CATEGORY_NAMES, assetCategoryNames); document.addKeyword(Field.ASSET_TAG_NAMES, assetTagNames); document.addKeyword(Field.ENTRY_CLASS_NAME, Slogan.class.getName()); document.addKeyword(Field.ENTRY_CLASS_PK, resourcePrimKey); return document; }
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 ww w . ja v a2 s . c om 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.docs.guestbook.search.GuestbookEntryKeywordQueryContributor.java
License:Open Source License
@Override public void contribute(String keywords, BooleanQuery booleanQuery, KeywordQueryContributorHelper keywordQueryContributorHelper) { SearchContext searchContext = keywordQueryContributorHelper.getSearchContext(); queryHelper.addSearchLocalizedTerm(booleanQuery, searchContext, Field.TITLE, false); queryHelper.addSearchLocalizedTerm(booleanQuery, searchContext, Field.CONTENT, false); queryHelper.addSearchLocalizedTerm(booleanQuery, searchContext, "entryEmail", false); }
From source file:com.liferay.docs.guestbook.search.GuestbookEntryModelDocumentContributor.java
License:Open Source License
@Override public void contribute(Document document, GuestbookEntry entry) { try {/*www . j a v a 2 s .c o m*/ Locale defaultLocale = PortalUtil.getSiteDefaultLocale(entry.getGroupId()); document.addDate(Field.MODIFIED_DATE, entry.getModifiedDate()); document.addText("entryEmail", entry.getEmail()); String localizedTitle = LocalizationUtil.getLocalizedName(Field.TITLE, defaultLocale.toString()); String localizedContent = LocalizationUtil.getLocalizedName(Field.CONTENT, defaultLocale.toString()); document.addText(localizedTitle, entry.getName()); document.addText(localizedContent, entry.getMessage()); long guestbookId = entry.getGuestbookId(); Guestbook guestbook = _guestbookLocalService.getGuestbook(guestbookId); String guestbookName = guestbook.getName(); String localizedGbName = LocalizationUtil.getLocalizedName(Field.NAME, defaultLocale.toString()); document.addText(localizedGbName, guestbookName); } catch (PortalException pe) { if (_log.isWarnEnabled()) { _log.warn("Unable to index entry " + entry.getEntryId(), pe); } } catch (Exception e) { e.printStackTrace(); } }
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.GuestbookEntrySearchRegistrar.java
License:Open Source License
@Activate protected void activate(BundleContext bundleContext) { _serviceRegistration = modelSearchRegistrarHelper.register(GuestbookEntry.class, bundleContext, modelSearchDefinition -> { modelSearchDefinition.setDefaultSelectedFieldNames(Field.COMPANY_ID, Field.ENTRY_CLASS_NAME, Field.ENTRY_CLASS_PK, Field.UID, Field.SCOPE_GROUP_ID, Field.GROUP_ID); modelSearchDefinition.setDefaultSelectedLocalizedFieldNames(Field.TITLE, Field.CONTENT); modelSearchDefinition.setModelIndexWriteContributor(modelIndexWriterContributor); modelSearchDefinition.setModelSummaryContributor(modelSummaryContributor); modelSearchDefinition.setSelectAllLocales(true); });/*from ww w . j a v a2 s. c om*/ }