• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DocumentImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.liferay.portal.kernel.search.DocumentImpl的典型用法代码示例。如果您正苦于以下问题:Java DocumentImpl类的具体用法?Java DocumentImpl怎么用?Java DocumentImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DocumentImpl类属于com.liferay.portal.kernel.search包,在下文中一共展示了DocumentImpl类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getLocalizedMap

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
private Map<Locale, String> getLocalizedMap(
	Locale[] locales, Document doc, String attribute, int pos) {

	Map<Locale, String> valueMap = new HashMap<Locale, String>();

	for (int i = 0; i<locales.length; i++) {
		String localizedFieldName = DocumentImpl.getLocalizedName(
			locales[i], attribute);

		if (!doc.hasField(localizedFieldName)) {
			continue;
		}

		String[] values = doc.getField(localizedFieldName).getValues();

		if (values.length >= (pos + 1)) {
			valueMap.put(locales[i], values[pos]);
		}
	}

	return valueMap;
}
 
开发者ID:jorgediaz-lr,项目名称:index-checker,代码行数:23,代码来源:IndexSearchHelper.java


示例2: addHighlights

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
private void addHighlights(Query query, SearchRequestBuilder searchRequestBuilder) {
    QueryConfig queryConfig = query.getQueryConfig();
    if (queryConfig.isHighlightEnabled()) {

        String localizedContentName = DocumentImpl.getLocalizedName(
                queryConfig.getLocale(), Field.CONTENT);

        String localizedTitleName = DocumentImpl.getLocalizedName(
                queryConfig.getLocale(), Field.TITLE);

        int fragmentSize = queryConfig.getHighlightFragmentSize();
        int numberOfFragments = queryConfig.getHighlightSnippetSize();
        searchRequestBuilder.addHighlightedField(Field.CONTENT, fragmentSize, numberOfFragments);
        searchRequestBuilder.addHighlightedField(Field.TITLE, fragmentSize, numberOfFragments);
        searchRequestBuilder.addHighlightedField(localizedContentName, fragmentSize, numberOfFragments);
        searchRequestBuilder.addHighlightedField(localizedTitleName, fragmentSize, numberOfFragments);

    }
}
 
开发者ID:R-Knowsys,项目名称:elasticray,代码行数:20,代码来源:ElasticsearchIndexSearcher.java


示例3: getUserProfile

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
@Override
public Document getUserProfile(long id, long groupId, ServiceContext serviceContext) {
	Employee employee = EmployeeLocalServiceUtil.fetchByF_mappingUserId(groupId, id);
	//TODO
	// PARTER INFO
	Document document = new DocumentImpl();
	
	User user = UserLocalServiceUtil.fetchUser(employee.getMappingUserId());
	
	String screenName = StringPool.BLANK;
	String email = StringPool.BLANK;
	
	if(Validator.isNotNull(user)){
		
		screenName = user.getScreenName();
		email = user.getEmailAddress();
		
	}
	
	document.addTextSortable("className", Employee.class.getName());
	document.addTextSortable("classPK", String.valueOf(employee.getEmployeeId()));
	
	document.addTextSortable("screenName", screenName);
	document.addTextSortable("email", email);
	document.addTextSortable("fullName", employee.getFullName());
	
	document.addTextSortable("contactEmail", employee.getEmail());
	document.addTextSortable("contactTelNo", employee.getTelNo());
	document.addNumberSortable("gender", employee.getGender());
	document.addDateSortable("birthdate", employee.getBirthdate());
	
	return document;
	
	
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:36,代码来源:UserActions.java


示例4: addSearchLocalizedTerm

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
@Override
protected void addSearchLocalizedTerm(
		BooleanQuery searchQuery, SearchContext searchContext, String field,
		boolean like)
	throws Exception {

	if (Validator.isNull(field)) {
		return;
	}

	String value = String.valueOf(searchContext.getAttribute(field));

	if (Validator.isNull(value)) {
		value = searchContext.getKeywords();
	}

	if (Validator.isNull(value)) {
		return;
	}

	field = DocumentImpl.getLocalizedName(searchContext.getLocale(), field);

	if (searchContext.isAndSearch()) {
		searchQuery.addRequiredTerm(field, value, like);
	}else {
		searchQuery.addTerm(field, value, like);
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:29,代码来源:CourseIndexer.java


示例5: doGetDocument

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
@Override
protected Document doGetDocument(Object obj) throws Exception {
	Competence entry = (Competence)obj;

	long companyId = entry.getCompanyId();
	long groupId = getParentGroupId(entry.getGroupId());
	long scopeGroupId = entry.getGroupId();
	long userId = entry.getUserId();
	long entryId = entry.getCompetenceId();
	String title = entry.getTitle();

	AssetEntry assetEntry=AssetEntryLocalServiceUtil.getEntry(Competence.class.getName(), entryId);
	String content=entry.getDescription();

	long[] assetCategoryIds = AssetCategoryLocalServiceUtil.getCategoryIds(
			Competence.class.getName(), entryId);

	String[] assetTagNames = AssetTagLocalServiceUtil.getTagNames(
			Competence.class.getName(), entryId);

	Document document = new DocumentImpl();
	document.addUID(PORTLET_ID, entryId);

	document.addKeyword(Field.CLASS_PK, entryId);
	document.addKeyword(Field.ENTRY_CLASS_NAME, Competence.class.getName());
	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, assetEntry.getSummary());
	document.addKeyword(Field.ASSET_CATEGORY_IDS, assetCategoryIds);
	document.addKeyword(Field.ASSET_TAG_NAMES, assetTagNames);
	
	return document;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:40,代码来源:CompetenceIndexer.java


示例6: getRoles

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
@Override
public JSONObject getRoles(long id, long groupId, ServiceContext serviceContext) {
	JSONObject result = JSONFactoryUtil.createJSONObject();

	List<Role> listRole = RoleLocalServiceUtil.getUserRoles(id);

	List<Document> list = new ArrayList<>();

	for (Role role : listRole) {

		Document document = new DocumentImpl();

		document.addNumberSortable("entryClassPK", role.getRoleId());
		document.addTextSortable("roleName", role.getName());

		list.add(document);
	}

	result.put("data", list);

	long total = listRole.size();

	result.put("total", total);

	return result;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:27,代码来源:UserActions.java


示例7: getForgot

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
@Override
public Document getForgot(long groupId, long companyId, String screenname_email, ServiceContext serviceContext) {
	Document document = new DocumentImpl();
	
	User user = UserLocalServiceUtil.fetchUserByEmailAddress(companyId, screenname_email);
	
	if(Validator.isNull(user)){
		user = UserLocalServiceUtil.fetchUserByScreenName(companyId, screenname_email);
	}
	
	long mappingUserId = Validator.isNotNull(user)?user.getUserId():0;
	String userName = Validator.isNotNull(user)?user.getFullName():StringPool.BLANK;
	
	
	Employee employee = EmployeeLocalServiceUtil.fetchByF_mappingUserId(groupId, mappingUserId);
	
	document.addTextSortable("userId", String.valueOf(mappingUserId));
	document.addTextSortable("userName", Validator.isNotNull(employee)?employee.getFullName():userName);
	document.addTextSortable("contactEmail", Validator.isNotNull(employee)?employee.getEmail():StringPool.BLANK);
	document.addTextSortable("contactTelNo", Validator.isNotNull(employee)?employee.getTelNo():StringPool.BLANK);
	
	//changePassWord
	String passWord = PwdGenerator.getPassword();
	
	try {
		
		user.setDigest(passWord);
		
		user = UserLocalServiceUtil.updateUser(user);
	
		JSONObject payLoad = JSONFactoryUtil.createJSONObject();
		
		payLoad.put("USERNAME", user.getScreenName());
		payLoad.put("USEREMAIL", user.getEmailAddress());
		payLoad.put("PASSWORD_CODE", passWord);
		
		NotificationQueueLocalServiceUtil.addNotificationQueue(user.getUserId(), groupId, Constants.USER_03,
				User.class.getName(), String.valueOf(user.getUserId()),
				payLoad.toJSONString(), "SYSTEM", employee.getFullName(),
				employee.getMappingUserId(), employee.getEmail(), employee.getTelNo(), new Date(),
				null, serviceContext);
		
	} catch (PortalException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return document;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:49,代码来源:UserActions.java


示例8: getForgotConfirm

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
@Override
public Document getForgotConfirm(long groupId, long companyId, String screenname_email, String code,
		ServiceContext serviceContext) throws DigestException {
	Document document = new DocumentImpl();
	
	User user = UserLocalServiceUtil.fetchUserByEmailAddress(companyId, screenname_email);
	
	if(Validator.isNull(user)){
		user = UserLocalServiceUtil.fetchUserByScreenName(companyId, screenname_email);
	}
	
	long mappingUserId = Validator.isNotNull(user)?user.getUserId():0;
	String userName = Validator.isNotNull(user)?user.getFullName():StringPool.BLANK;
	
	//changePassWord
	String passWord = PwdGenerator.getPassword();
			
	try {
		
		if(user.getDigest().equals(code)){
			user = UserLocalServiceUtil.updatePassword(user.getUserId(), passWord, passWord, Boolean.TRUE);
			
			user.setDigest(passWord + System.currentTimeMillis());
			
			UserLocalServiceUtil.updateUser(user);
			
		} else {
			
			throw new DigestException();
			
		}
		
		Employee employee = EmployeeLocalServiceUtil.fetchByF_mappingUserId(groupId, mappingUserId);
		
		document.addTextSortable("userId", String.valueOf(mappingUserId));
		document.addTextSortable("userName", Validator.isNotNull(employee)?employee.getFullName():userName);
		document.addTextSortable("contactEmail", Validator.isNotNull(employee)?employee.getEmail():StringPool.BLANK);
		document.addTextSortable("contactTelNo", Validator.isNotNull(employee)?employee.getTelNo():StringPool.BLANK);
		
		JSONObject payLoad = JSONFactoryUtil.createJSONObject();
		
		payLoad.put("USERNAME", user.getScreenName());
		payLoad.put("USEREMAIL", user.getEmailAddress());
		payLoad.put("PASSWORD", passWord);
		
		NotificationQueueLocalServiceUtil.addNotificationQueue(user.getUserId(), groupId, Constants.USER_04,
				User.class.getName(), String.valueOf(user.getUserId()),
				payLoad.toJSONString(), "SYSTEM", employee.getFullName(),
				employee.getMappingUserId(), employee.getEmail(), employee.getTelNo(), new Date(),
				null, serviceContext);
		
	} catch (PortalException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return document;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:58,代码来源:UserActions.java


示例9: doGetDocument

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
@Override
	protected Document doGetDocument(Object obj) throws Exception {
//		_log.debug("doGetDocument()");
		Application application = (Application) obj;
        long companyId = application.getCompanyId();
//        long groupId = getParentGroupId(application.getGroupId());
//        long scopeGroupId = application.getGroupId();
//        long groupId = 20102;
//        long scopeGroupId = 20102;
      
        long userId = application.getUserId();
        long resourcePrimKey = application.getPrimaryKey();
        String title = application.getName().toLowerCase();
        String content = "";
        String description = application.getDescription().toLowerCase();
        String regions = application.getRegionString().toLowerCase();
        String categoryString = application.getCategoryString().toLowerCase();
        String targetOS = application.getTargetOS().toLowerCase();
        content = content + " " + application.getRegionString().toLowerCase();
        content = content + " " + application.getCategoryString().toLowerCase();
        content = content + " " + application.getTargetOS().toLowerCase();
//        content = content + " " + application.getMinTargetOSVersion();

        
        Date modifiedDate = application.getModifiedDate();

       long[] assetCategoryIds = AssetCategoryLocalServiceUtil.getCategoryIds(Application.class.getName(), resourcePrimKey);
       
       List<AssetCategory> categories = AssetCategoryLocalServiceUtil.getCategories(Application.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(Application.class.getName(), resourcePrimKey);

        Document document = new DocumentImpl();

        document.addUID(PORTLET_ID, resourcePrimKey);

        document.addDate("modifiedDate", 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.addText("regions", regions);
        document.addText("categoryString", categoryString);
        document.addText("targetOS", targetOS);
        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, Application.class.getName());
        document.addKeyword(Field.ENTRY_CLASS_PK, resourcePrimKey);
        
        return document;
	}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:66,代码来源:ApplicationIndexer.java


示例10: doGetDocument

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
@Override
protected Document doGetDocument(Object obj) throws Exception {
	Course entry = (Course)obj;
	AssetEntry asset=AssetEntryLocalServiceUtil.getEntry(Course.class.getName(), entry.getCourseId());
	long companyId = entry.getCompanyId();
	long groupId = getParentGroupId(entry.getGroupId());
	long scopeGroupId = entry.getGroupId();
	long userId = entry.getUserId();
	User user=UserLocalServiceUtil.getUser(userId);
	String userName = user.getFullName();
	long entryId = entry.getCourseId();
	String title = entry.getTitle();
	String content = HtmlUtil.extractText(entry.getDescription());
	Date displayDate = asset.getPublishDate();

	long[] assetCategoryIds =AssetCategoryLocalServiceUtil.getCategoryIds(Course.class.getName(), entryId);
	String[] assetTagNames =AssetTagLocalServiceUtil.getTagNames(Course.class.getName(), entryId);

	ExpandoBridge expandoBridge = entry.getExpandoBridge();

	Document document = new DocumentImpl();

	document.addUID(PORTLET_ID, entryId);

	document.addModifiedDate(displayDate);

	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.USER_NAME, userName);

	document.addText(Field.TITLE, title);
	document.addText(Field.CONTENT, content);
	document.addKeyword(Field.ASSET_CATEGORY_IDS, assetCategoryIds);
	document.addKeyword(Field.ASSET_TAG_NAMES, assetTagNames);

	document.addKeyword(Field.ENTRY_CLASS_NAME, LearningActivity.class.getName());
	document.addKeyword(Field.ENTRY_CLASS_PK, entryId);

	ExpandoBridgeIndexerUtil.addAttributes(document, expandoBridge);

	return document;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:46,代码来源:CourseIndexer.java


示例11: doGetDocument

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
protected Document doGetDocument(Object obj) {
	try{
		LearningActivity entry = (LearningActivity)obj;

		long companyId = entry.getCompanyId();
		long groupId = getParentGroupId(entry.getGroupId());
		long scopeGroupId = entry.getGroupId();
		long userId = entry.getUserId();
		String userName = PortalUtil.getUserName(userId, entry.getUserName());
		long entryId = entry.getActId();
		String title = entry.getTitle();
		String content = HtmlUtil.extractText(entry.getDescription());
		Date displayDate = entry.getCreateDate();

		long[] assetCategoryIds = new long[0];
			//AssetCategoryLocalServiceUtil.getCategoryIds(				LearningActivity.class.getName(), entryId);
		String[] assetTagNames =new String[0];
			//AssetTagLocalServiceUtil.getTagNames(			BlogsEntry.class.getName(), entryId);

		ExpandoBridge expandoBridge = entry.getExpandoBridge();

		Document document = new DocumentImpl();

		document.addUID(PORTLET_ID, entryId);

		document.addModifiedDate(displayDate);

		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.USER_NAME, userName);

		document.addText(Field.TITLE, title);
		document.addText(Field.CONTENT, content);
		document.addKeyword(Field.ASSET_CATEGORY_IDS, assetCategoryIds);
		document.addKeyword(Field.ASSET_TAG_NAMES, assetTagNames);

		document.addKeyword(Field.ENTRY_CLASS_NAME, LearningActivity.class.getName());
		document.addKeyword(Field.ENTRY_CLASS_PK, entryId);

		ExpandoBridgeIndexerUtil.addAttributes(document, expandoBridge);

		return document;
	}catch(Exception e){
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:51,代码来源:LearningActivityIndexer.java


示例12: getDocuments

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
/**
  * Gets the documents.
  *
  * @param searchHits the search hits
  * @return the documents
  */
 private Document[] getDocuments(SearchHits searchHits) {
     if (_log.isInfoEnabled()) {
         _log.info("Getting document objects from SearchHits");
     }
     int total = Integer.parseInt((searchHits != null)? String.valueOf(searchHits.getTotalHits()) : "0");
     int failedJsonCount = 0;
     if (total > 0) {
         List<Document> documentsList = new ArrayList<Document>(total);
         @SuppressWarnings("rawtypes")
Iterator itr = searchHits.iterator();
         while (itr.hasNext()) {
             Document document = new DocumentImpl();
             SearchHit hit = (SearchHit) itr.next();
             
             JSONObject json;
             try {
                 json = JSONFactoryUtil.createJSONObject(hit.getSourceAsString());
                 @SuppressWarnings("rawtypes")
		Iterator jsonItr = json.keys();
                 while (jsonItr.hasNext()) {
                     String key = (String) jsonItr.next();
                     String value = (String) json.getString(key);
                     if (_log.isDebugEnabled()) {
                         _log.debug(">>>>>>>>>> " + key + " : " + value);
                     }
                     document.add(new Field(key, value));
                 }
                 documentsList.add(document);
             } catch (JSONException e) {
                 failedJsonCount++;
                 _log.error("Error while processing the search result json objects", e);
             }               
         }
         if (_log.isInfoEnabled()) {
             _log.info("Total size of the search results: " + documentsList.size());
         }
         return documentsList.toArray(new Document[documentsList.size()-failedJsonCount]);
     } else {
         if (_log.isInfoEnabled()) {
             _log.info("No search results found");
         }
         return new Document[0];
     }   
 }
 
开发者ID:rivetlogic,项目名称:liferay-elasticsearch-integration,代码行数:51,代码来源:ElasticsearchHelper.java


示例13: getSnippet

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
protected String getSnippet(
        SearchHit searchHit, QueryConfig queryConfig,
        Set<String> queryTerms,
        Map<String, HighlightField> highlights, String field) {

    if (highlights == null) {
        return StringPool.BLANK;
    }

    boolean localizedSearch = true;

    String defaultLanguageId = LocaleUtil.toLanguageId(
            LocaleUtil.getDefault());
    String queryLanguageId = LocaleUtil.toLanguageId(
            queryConfig.getLocale());

    if (defaultLanguageId.equals(queryLanguageId)) {
        localizedSearch = false;
    }

    if (localizedSearch) {
        String localizedName = DocumentImpl.getLocalizedName(
                queryConfig.getLocale(), field);

        if (searchHit.fields().containsKey(localizedName)) {
            field = localizedName;
        }
    }
    HighlightField hField = highlights.get(field);
    if (hField == null) {
        return StringPool.BLANK;
    }

    List<String> snippets = new ArrayList<String>();
    Text[] txtArr = hField.getFragments();
    if (txtArr == null) {
        return StringPool.BLANK;
    }
    for (Text txt : txtArr) {
        snippets.add(txt.string());
    }

    String snippet = StringUtil.merge(snippets, "...");

    if (Validator.isNotNull(snippet)) {
        snippet = snippet + "...";
    } else {
        snippet = StringPool.BLANK;
    }

    Pattern pattern = Pattern.compile("<em>(.*?)</em>");

    Matcher matcher = pattern.matcher(snippet);

    while (matcher.find()) {
        queryTerms.add(matcher.group(1));
    }

    snippet = StringUtil.replace(snippet, "<em>", "");
    snippet = StringUtil.replace(snippet, "</em>", "");

    return snippet;
}
 
开发者ID:R-Knowsys,项目名称:elasticray,代码行数:64,代码来源:ElasticsearchIndexSearcher.java


示例14: addSortToSearch

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
private void addSortToSearch(Sort[] sorts, SearchRequestBuilder searchRequestBuilder) {
 	String query = searchRequestBuilder.toString();
 	if(query.contains("assetTagNames")) //term search
 	{
 		 //always adds score to the sort
  	   searchRequestBuilder.addSort(SortBuilders.scoreSort());
 	}
 	else //empty search
 	{
        //no score needed
 		if(query.contains("com.liferay.portal.model.Organization"))
{
 			searchRequestBuilder.addSort(SortBuilders.fieldSort("name_sortable").ignoreUnmapped(true).order(SortOrder.ASC));
}
 	}
 	if (sorts == null) {
 		//for alphabetic order on orgs

         return;
     }
     for (Sort sort : sorts) {
     	if (sort == null) {
	continue;
}
String sortFieldName = sort.getFieldName();
         SortBuilder sortBuilder = null;

if (DocumentImpl.isSortableTextField(sortFieldName)) {
	sortFieldName = DocumentImpl.getSortableFieldName(
		sortFieldName);
}
if (Validator.isNull(sortFieldName) ||
		!sortFieldName.endsWith("sortable")) {
		continue;
	}
             sortBuilder = SortBuilders.fieldSort(sortFieldName).ignoreUnmapped(true)
                     .order(sort.isReverse() ? SortOrder.DESC : SortOrder.ASC);

             searchRequestBuilder.addSort(sortBuilder);
     }
 }
 
开发者ID:R-Knowsys,项目名称:elasticray,代码行数:42,代码来源:ElasticsearchIndexSearcher.java


示例15: doDelete

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
protected void doDelete(Object obj) throws Exception {
	LearningActivity entry = (LearningActivity)obj;

	Document document = new DocumentImpl();

	document.addUID(PORTLET_ID, entry.getActId());

	SearchEngineUtil.deleteDocument(
		entry.getCompanyId(), document.get(Field.UID));
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:11,代码来源:LearningActivityIndexer.java


示例16: doDelete

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
@Override
protected void doDelete(Object obj) throws Exception {
	Competence entry = (Competence)obj;

	Document document = new DocumentImpl();

	document.addUID(PORTLET_ID, entry.getCompanyId());

	deleteDocument(entry.getCompanyId(), document.get(Field.UID));
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:11,代码来源:CompetenceIndexer.java


示例17: getSites

import com.liferay.portal.kernel.search.DocumentImpl; //导入依赖的package包/类
@Override
public JSONObject getSites(long id, long groupId, ServiceContext serviceContext) {
	JSONObject result = JSONFactoryUtil.createJSONObject();

	try {
		List<Group> listGroup = GroupLocalServiceUtil.getUserSitesGroups(id);

		List<Document> list = new ArrayList<>();

		for (Group group : listGroup) {

			Document document = new DocumentImpl();

			OfficeSite officeSite = OfficeSiteLocalServiceUtil.fetchF_groupId_siteGroupId(groupId,
					group.getGroupId());

			if(Validator.isNotNull(officeSite)){
				
				document.addNumberSortable("entryClassPK", officeSite.getOfficeSiteId());
				document.addTextSortable("siteName", officeSite.getName());
				
			} else {
				
				document.addNumberSortable("entryClassPK", 0);
				document.addTextSortable("siteName", group.getName(locale));
				
			}
			
			document.addNumberSortable("siteGroupId", group.getGroupId());
			
			boolean isCurrent = false;

			if (group.getGroupId() == groupId) {

				isCurrent = true;

			}
			document.addTextSortable("currentSite", String.valueOf(isCurrent));

			list.add(document);

		}

		result.put("data", list);

		long total = listGroup.size();

		result.put("total", total);

	} catch (PortalException e) {
		e.printStackTrace();
	}

	return result;

}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:57,代码来源:UserActions.java



注:本文中的com.liferay.portal.kernel.search.DocumentImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Read类代码示例发布时间:2022-05-22
下一篇:
Java TreeViewList类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap