List of usage examples for com.liferay.portal.kernel.search Field GROUP_ID
String GROUP_ID
To view the source code for com.liferay.portal.kernel.search Field GROUP_ID.
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 ww w. j a va 2 s .c om*/ setFilterSearch(true); setPermissionAware(false); }
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;/* w ww . ja v a2s .c om*/ 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.alloy.mvc.BaseAlloyControllerImpl.java
License:Open Source License
protected AlloySearchResult search(Indexer indexer, AlloyServiceInvoker alloyServiceInvoker, HttpServletRequest request, PortletRequest portletRequest, SearchContainer<? extends BaseModel<?>> searchContainer, Map<String, Serializable> attributes, String keywords, Sort[] sorts) throws Exception { if (indexer == null) { throw new Exception("No indexer found for " + controllerPath); }/*from w ww . j a v a 2s . co m*/ AlloySearchResult alloySearchResult = new AlloySearchResult(); alloySearchResult.setAlloyServiceInvoker(alloyServiceInvoker); if (searchContainer == null) { searchContainer = new SearchContainer<BaseModel<?>>(portletRequest, portletURL, null, null); } SearchContext searchContext = SearchContextFactory.getInstance(request); boolean andOperator = ParamUtil.getBoolean(request, "andOperator"); searchContext.setAndSearch(andOperator); if ((attributes != null) && !attributes.isEmpty()) { searchContext.setAttributes(attributes); } searchContext.setEnd(searchContainer.getEnd()); Class<?> indexerClass = Class.forName(indexer.getClassNames()[0]); if (!GroupedModel.class.isAssignableFrom(indexerClass)) { searchContext.setGroupIds(null); } else if (searchContext.getAttribute(Field.GROUP_ID) != null) { long groupId = GetterUtil.getLong(searchContext.getAttribute(Field.GROUP_ID)); searchContext.setGroupIds(new long[] { groupId }); } if (Validator.isNotNull(keywords)) { searchContext.setKeywords(keywords); } if (ArrayUtil.isNotEmpty(sorts)) { searchContext.setSorts(sorts); } searchContext.setStart(searchContainer.getStart()); Hits hits = indexer.search(searchContext); alloySearchResult.setHits(hits); alloySearchResult.setPortletURL(portletURL, searchContext.getAttributes()); alloySearchResult.afterPropertiesSet(); return alloySearchResult; }
From source file:com.liferay.asset.categories.internal.search.AssetCategoryIndexer.java
License:Open Source License
public AssetCategoryIndexer() { setDefaultSelectedFieldNames(Field.ASSET_CATEGORY_ID, Field.COMPANY_ID, Field.GROUP_ID, Field.UID); setFilterSearch(true); setPermissionAware(true); }
From source file:com.liferay.asset.categories.internal.search.AssetVocabularyIndexer.java
License:Open Source License
public AssetVocabularyIndexer() { setDefaultSelectedFieldNames(Field.ASSET_VOCABULARY_ID, Field.COMPANY_ID, Field.GROUP_ID, Field.UID); setFilterSearch(true); setPermissionAware(true); }
From source file:com.liferay.asset.search.test.AssetSearcherStagingTest.java
License:Open Source License
@Test public void testSiteRolePermissions() throws Exception { Role role = addRole(RoleConstants.TYPE_SITE); String className = "com.liferay.journal.model.JournalArticle"; RoleTestUtil.addResourcePermission(role, className, ResourceConstants.SCOPE_GROUP_TEMPLATE, "0", ActionKeys.VIEW);//from w ww . j a v a 2s . c om User user = addUser(); ServiceTestUtil.setUser(user); addUserGroupRole(user, role); addJournalArticle(); GroupTestUtil.enableLocalStaging(_group); SearchContext searchContext = getSearchContext(); Group stagingGroup = _group.getStagingGroup(); searchContext.setGroupIds(new long[] { stagingGroup.getGroupId() }); searchContext.setUserId(user.getUserId()); QueryConfig queryConfig = searchContext.getQueryConfig(); queryConfig.addSelectedFieldNames(Field.GROUP_ID, Field.STAGING_GROUP); AssetEntryQuery assetEntryQuery = getAssetEntryQuery(className); Hits hits = search(assetEntryQuery, searchContext); Document[] documents = hits.getDocs(); DocumentsAssert.assertCount(hits.toString(), documents, Field.COMPANY_ID, 1); Document document = documents[0]; assertField(document, Field.GROUP_ID, String.valueOf(stagingGroup.getGroupId())); assertField(document, Field.STAGING_GROUP, StringPool.TRUE); }
From source file:com.liferay.asset.search.test.AssetUtilSearchSortTest.java
License:Open Source License
protected SearchContext createSearchContext() { SearchContext searchContext = new SearchContext(); searchContext.setAttribute(Field.GROUP_ID, _group.getGroupId()); searchContext.setCompanyId(_group.getCompanyId()); searchContext.setGroupIds(new long[] { _group.getGroupId() }); searchContext.setKeywords(StringPool.BLANK); searchContext.setUserId(_group.getCreatorUserId()); return searchContext; }
From source file:com.liferay.asset.tags.internal.search.AssetTagIndexer.java
License:Open Source License
public AssetTagIndexer() { setDefaultSelectedFieldNames(Field.COMPANY_ID, Field.GROUP_ID, Field.UID); setFilterSearch(true); setPermissionAware(true); }
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 w w. j av a2 s . c o m*/ setFilterSearch(true); setPermissionAware(true); }
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);/*w w w . j a va 2s.co m*/ setPermissionAware(true); }