本文整理汇总了Java中com.liferay.portal.kernel.search.Document.addKeyword方法的典型用法代码示例。如果您正苦于以下问题:Java Document.addKeyword方法的具体用法?Java Document.addKeyword怎么用?Java Document.addKeyword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.search.Document
的用法示例。
在下文中一共展示了Document.addKeyword方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doGetDocument
import com.liferay.portal.kernel.search.Document; //导入方法依赖的package包/类
@Override
protected Document doGetDocument(TaskRecord taskRecord) throws Exception {
Document document = getBaseModelDocument(CLASS_NAME, taskRecord);
document.addDateSortable(Field.CREATE_DATE, taskRecord.getCreateDate());
document.addTextSortable("description", taskRecord.getDescription());
document.addNumberSortable("duration", taskRecord.getDuration());
document.addDateSortable("fromDate", taskRecord.getFromDate());
document.addNumberSortable("taskRecordId", taskRecord.getTaskRecordId());
document.addNumberSortable(Field.STATUS, taskRecord.getStatus());
document.addTextSortable("ticketURL", taskRecord.getTicketURL());
document.addKeyword("ownerUserId", taskRecord.getUserId());
document.addDateSortable("modifiedDate", taskRecord.getModifiedDate());
document.addDateSortable("untilDate", taskRecord.getUntilDate());
document.addTextSortable("userName", taskRecord.getUserName());
document.addTextSortable("workPackage", taskRecord.getWorkPackage());
return document;
}
示例2: doGetDocument
import com.liferay.portal.kernel.search.Document; //导入方法依赖的package包/类
@Override
protected Document doGetDocument(Contact contact) throws Exception {
Document document = getBaseModelDocument(CLASS_NAME, contact);
// Set document field values (in alphabetical order)
document.addTextSortable("city", contact.getAddress().getLocality());
document.addTextSortable("company", contact.getCompany());
document.addNumberSortable("contactId", contact.getContactId());
document.addText(Field.CONTENT, contact.getCard());
document.addTextSortable("country", contact.getAddress().getCountry());
document.addDateSortable(Field.CREATE_DATE, contact.getCreateDate());
document.addText(Field.DESCRIPTION, "TODO: contact description");
document.addTextSortable("email", contact.getEmail().getAddress());
// TODO: add default fax
document.addTextSortable("fullName", contact.getFullName(false));
document.addKeyword(Field.GROUP_ID, getSiteGroupId(contact.getGroupId()));
// TODO add default impp
document.addDateSortable("modifiedDate", contact.getModifiedDate());
document.addTextSortable(Field.NAME, contact.getName());
document.addTextSortable("phone", contact.getPhone().getNumber());
document.addNumber(Field.STATUS, contact.getStatus());
document.addKeyword(Field.SCOPE_GROUP_ID, contact.getGroupId());
document.addText(Field.TITLE, contact.getName());
document.addTextSortable("url", contact.getUrl());
document.addKeyword("vCardUID", contact.getUid());
document.addTextSortable("x-salutation", contact.getSalutation());
return document;
}
示例3: doGetDocument
import com.liferay.portal.kernel.search.Document; //导入方法依赖的package包/类
@Override
protected Document doGetDocument(RegistrationForm object) throws Exception {
Document document = getBaseModelDocument(CLASS_NAME, object);
// Indexer of audit fields
document.addNumberSortable(Field.COMPANY_ID, object.getCompanyId());
document.addNumberSortable(Field.GROUP_ID, object.getGroupId());
document.addDateSortable(Field.MODIFIED_DATE, object.getCreateDate());
document.addDateSortable(Field.CREATE_DATE, object.getModifiedDate());
document.addNumberSortable(Field.USER_ID, object.getUserId());
document.addKeywordSortable(Field.ENTRY_CLASS_NAME, CLASS_NAME);
document.addNumberSortable(Field.ENTRY_CLASS_PK, object.getPrimaryKey());
// add number fields
document.addNumberSortable(RegistrationFormTerm.REGISTRATION_ID, object.getRegistrationId());
// add text fields
document.addTextSortable(RegistrationFormTerm.REFERENCE_UID, object.getReferenceUid());
document.addTextSortable(RegistrationFormTerm.FORM_NO, object.getFormNo());
document.addTextSortable(RegistrationFormTerm.FORM_NAME, object.getFormName());
document.addTextSortable(RegistrationFormTerm.ISNEW, String.valueOf(object.isIsNew()));
document.addTextSortable(RegistrationFormTerm.REMOVED, String.valueOf(object.isRemoved()));
document.addTextSortable(RegistrationFormTerm.FORM_NO, String.valueOf(object.getFormNo()).toLowerCase());
document.addText(RegistrationFormTerm.FORM_DATA, object.getFormData());
// index formData
try {
JSONObject jsonObject =
JSONFactoryUtil.createJSONObject(object.getFormData());
List<Object[]> keyValues = new ArrayList<Object[]>();
parseJSONObject(keyValues, jsonObject);
if (keyValues != null) {
for (Object[] keyValue : keyValues) {
_log.info("=========REGISTRATION_FORM_INDEX_FORM_DATA========:" + keyValue[0] + "_" + keyValue[1]);
document.addKeyword(
keyValue[0].toString(), keyValue[1].toString());
}
}
}
catch (Exception e) {
_log.error(e);
}
return document;
}
示例4: doGetDocument
import com.liferay.portal.kernel.search.Document; //导入方法依赖的package包/类
@Override
protected Document doGetDocument(Deliverable object) throws Exception {
Document document = getBaseModelDocument(CLASS_NAME, object);
// Indexer of audit fields
document.addNumberSortable(Field.COMPANY_ID, object.getCompanyId());
document.addNumberSortable(Field.GROUP_ID, object.getGroupId());
document.addDateSortable(Field.MODIFIED_DATE, object.getCreateDate());
document.addDateSortable(Field.CREATE_DATE, object.getModifiedDate());
document.addNumberSortable(Field.USER_ID, object.getUserId());
document.addKeywordSortable(Field.USER_NAME, String.valueOf(object.getUserName()));
document.addKeywordSortable(Field.ENTRY_CLASS_NAME, CLASS_NAME);
document.addNumberSortable(Field.ENTRY_CLASS_PK, object.getPrimaryKey());
// add number fields
document.addNumber(DeliverableTerm.DELIVERABLE_ID, object.getDeliverableId());
document.addDateSortable(DeliverableTerm.ISSUE_DATE, object.getIssueDate());
document.addDateSortable(DeliverableTerm.EXPIRE_DATE, object.getExpireDate());
document.addDateSortable(DeliverableTerm.REVALIDATE, object.getRevalidate());
// add number fields
// document.addNumberSortable(DossierActionTerm.DOSSIER_ID, object.getDossierId());
// document.addNumberSortable(DossierActionTerm.SERVICE_PROCESS_ID, object.getServiceProcessId());
// document.addNumberSortable(DossierActionTerm.PREVIOUS_ACTION_ID, object.getPreviousActionId());
// document.addNumberSortable(DossierActionTerm.ACTION_OVER_DUE, object.getActionOverdue());
// document.addNumberSortable(DossierActionTerm.NEXT_ACTION_ID, object.getNextActionId());
// add text fields
document.addTextSortable(DeliverableTerm.DELIVERABLE_CODE, object.getDeliverableCode());
document.addTextSortable(DeliverableTerm.DELIVERABLE_NAME, object.getDeliverableName());
document.addTextSortable(DeliverableTerm.DELIVERABLE_TYPE, object.getDeliverableType());
document.addTextSortable(DeliverableTerm.GOV_AGENCY_CODE, object.getGovAgencyCode());
document.addTextSortable(DeliverableTerm.GOV_AGENCY_NAME, object.getGovAgencyName());
document.addTextSortable(DeliverableTerm.APPLICANT_ID_NO, object.getApplicantIdNo());
document.addTextSortable(DeliverableTerm.APPLICANT_NAME, object.getApplicantName());
document.addTextSortable(DeliverableTerm.SUBJECT, object.getSubject());
document.addTextSortable(DeliverableTerm.FORM_DATA, object.getFormData());
String formData = object.getFormData();
if (Validator.isNotNull(formData)) {
List<Object[]> keyValues = new ArrayList<Object[]>();
keyValues = getKeyValues(formData, keyValues);
if (keyValues != null) {
for (Object[] keyValue : keyValues) {
document.addKeyword(keyValue[0].toString(),
keyValue[1].toString());
}
}
}
document.addTextSortable(DeliverableTerm.FORM_SCRIPT, object.getFormScript());
document.addTextSortable(DeliverableTerm.FORM_REPORT, object.getFormReport());
document.addTextSortable(DeliverableTerm.DELIVERABLE_STATE, object.getDeliverableState());
return document;
}