本文整理汇总了Java中com.liferay.portal.kernel.search.SearchContext.getAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java SearchContext.getAttribute方法的具体用法?Java SearchContext.getAttribute怎么用?Java SearchContext.getAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.search.SearchContext
的用法示例。
在下文中一共展示了SearchContext.getAttribute方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postProcessSearchQuery
import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
SearchContext searchContext) throws Exception {
boolean advancedSearch = GetterUtil.getBoolean(searchContext.getAttribute("advancedSearch"), false);
addSearchTerm(searchQuery, searchContext, "description", false);
if (!advancedSearch) {
addSearchTerm(searchQuery, searchContext, "workPackage", true);
}
// TODO: add ticketURL
LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");
if (params != null) {
String expandoAttributes = (String) params.get("expandoAttributes");
if (Validator.isNotNull(expandoAttributes)) {
addSearchExpando(searchQuery, searchContext, expandoAttributes);
}
}
}
示例2: postProcessSearchQuery
import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery,
BooleanFilter fullQueryBooleanFilter, SearchContext searchContext)
throws Exception {
addSearchTerm(searchQuery, searchContext, "data", false);
LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext
.getAttribute("params");
if (params != null) {
String expandoAttributes = (String) params.get("expandoAttributes");
if (Validator.isNotNull(expandoAttributes)) {
addSearchExpando(searchQuery, searchContext, expandoAttributes);
}
}
}
示例3: postProcessSearchQuery
import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
SearchContext searchContext) throws Exception {
addSearchTerm(searchQuery, searchContext, "company", false);
addSearchTerm(searchQuery, searchContext, "fullName", false);
LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");
if (params != null) {
String expandoAttributes = (String) params.get("expandoAttributes");
if (Validator.isNotNull(expandoAttributes)) {
addSearchExpando(searchQuery, searchContext, expandoAttributes);
}
}
}
示例4: postProcessSearchQuery
import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
SearchContext searchContext) throws Exception {
@SuppressWarnings("unchecked")
LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");
if (params != null) {
String expandoAttributes = (String) params.get("expandoAttributes");
if (Validator.isNotNull(expandoAttributes)) {
addSearchExpando(searchQuery, searchContext, expandoAttributes);
}
}
}
示例5: postProcessSearchQuery
import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
SearchContext searchContext) throws Exception {
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.OFFICE_SITE_ID, false);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.GROUP_ID, false);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.COMPANY_ID, false);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.USER_ID, false);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.USER_NAME, false);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.CREATE_DATE, false);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.MODIFIED_DATE, false);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.NAME, true);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.EN_NAME, true);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.GOV_AGENCY_CODE, true);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.ADDRESS, true);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.TEL_NO, true);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.FAX_NO, true);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.EMAIL, true);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.WEBSITE, true);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.LOGO_FILE_ENTRY_ID, true);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.SITE_GROUP_ID, true);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.ADMIN_USER_ID, true);
addSearchTerm(searchQuery, searchContext, OfficeSiteTerm.PREFERENCES, true);
@SuppressWarnings("unchecked")
LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");
if (params != null) {
String expandoAttributes = (String) params.get("expandoAttributes");
if (Validator.isNotNull(expandoAttributes)) {
addSearchExpando(searchQuery, searchContext, expandoAttributes);
}
}
}
示例6: postProcessSearchQuery
import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
SearchContext searchContext) throws Exception {
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.WORKINGUNIT_ID, false);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.GROUP_ID, false);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.COMPANY_ID, false);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.USER_ID, false);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.USER_NAME, false);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.CREATE_DATE, false);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.MODIFIED_DATE, false);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.NAME, true);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.ENNAME, true);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.GOV_AGENCY_CODE, true);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.PARENT_WORKING_UNIT_ID, true);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.SIBLING, true);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.TREEINDEX, true);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.ADDRESS, true);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.TEL_NO, true);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.FAX_NO, true);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.EMAIL, true);
addSearchTerm(searchQuery, searchContext, WorkingUnitTerm.WEBSITE, true);
@SuppressWarnings("unchecked")
LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");
if (params != null) {
String expandoAttributes = (String) params.get("expandoAttributes");
if (Validator.isNotNull(expandoAttributes)) {
addSearchExpando(searchQuery, searchContext, expandoAttributes);
}
}
}
示例7: postProcessSearchQuery
import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
SearchContext searchContext) throws Exception {
LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");
if (params != null) {
String expandoAttributes = (String) params.get("expandoAttributes");
if (Validator.isNotNull(expandoAttributes)) {
addSearchExpando(searchQuery, searchContext, expandoAttributes);
}
}
}
示例8: postProcessSearchQuery
import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
SearchContext searchContext) throws Exception {
addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.NOTIFICATIONTEMPLATE_ID, false);
addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.GROUP_ID, false);
addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.COMPANY_ID, false);
addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.USER_NAME, false);
addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.USER_ID, false);
addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.CREATE_DATE, false);
addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.MODIFIED_DATE, false);
addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.NOTIFICATTION_TYPE, true);
addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.NOTIFICATION_EMAIL_SUBJECT, true);
addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.NOTIFICATION_EMAIL_BODY, true);
addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.NOTIFICATION_TEXT_MESSAGE, true);
addSearchTerm(searchQuery, searchContext, NotificationTemplateTerm.NOTIFICATION_SEND_SMS, true);
LinkedHashMap<String, Object> params = (LinkedHashMap<String, Object>) searchContext.getAttribute("params");
if (params != null) {
String expandoAttributes = (String) params.get("expandoAttributes");
if (Validator.isNotNull(expandoAttributes)) {
addSearchExpando(searchQuery, searchContext, expandoAttributes);
}
}
}
示例9: postProcessContextBooleanFilter
import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessContextBooleanFilter(BooleanFilter contextBooleanFilter, SearchContext searchContext)
throws Exception {
addStatus(contextBooleanFilter, searchContext);
// from- and until-date
Date fromDate = GetterUtil.getDate(searchContext.getAttribute("fromDate"), DateFormat.getDateInstance(), null);
Date untilDate = GetterUtil.getDate(searchContext.getAttribute("untilDate"), DateFormat.getDateInstance(),
null);
long max = Long.MAX_VALUE;
long min = Long.MIN_VALUE;
if (fromDate != null) {
min = fromDate.getTime();
}
if (untilDate != null) {
max = untilDate.getTime();
}
contextBooleanFilter.addRangeTerm("fromDate_Number_sortable", min, max);
// workPackage
boolean advancedSearch = GetterUtil.getBoolean(searchContext.getAttribute("advancedSearch"), false);
String workPackage = (String) searchContext.getAttribute("workPackage");
if (Validator.isNotNull(workPackage) && advancedSearch) {
BooleanFilter booleanFilter = new BooleanFilter();
// Use the sortable index field, since the regular field is
// analyzed, which means, we can't use hyphens in workpackage
// names.
PrefixFilter prefixFilter = new PrefixFilter("workPackage_sortable", workPackage);
booleanFilter.add(prefixFilter);
contextBooleanFilter.add(booleanFilter, BooleanClauseOccur.MUST);
}
}
示例10: postProcessSearchQuery
import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessSearchQuery(
BooleanQuery searchQuery, BooleanFilter fullQueryBooleanFilter,
SearchContext searchContext)
throws Exception {
addSearchTerm(
searchQuery, searchContext, CommentTerm.COMMENT_ID, false);
addSearchTerm(searchQuery, searchContext, CommentTerm.GROUP_ID, false);
addSearchTerm(
searchQuery, searchContext, CommentTerm.COMPANY_ID, false);
addSearchTerm(searchQuery, searchContext, CommentTerm.USER_ID, false);
addSearchTerm(searchQuery, searchContext, CommentTerm.USER_NAME, false);
addSearchTerm(
searchQuery, searchContext, CommentTerm.CREATE_DATE, false);
addSearchTerm(
searchQuery, searchContext, CommentTerm.MODIFIED_DATE, false);
addSearchTerm(searchQuery, searchContext, CommentTerm.CLASS_NAME, true);
addSearchTerm(searchQuery, searchContext, CommentTerm.CLASS_PK, true);
addSearchTerm(searchQuery, searchContext, CommentTerm.FULL_NAME, true);
addSearchTerm(searchQuery, searchContext, CommentTerm.EMAIL, true);
addSearchTerm(searchQuery, searchContext, CommentTerm.PARENT, false);
addSearchTerm(searchQuery, searchContext, CommentTerm.CONTENT, true);
addSearchTerm(
searchQuery, searchContext, CommentTerm.FILE_ENTRY_ID, false);
addSearchTerm(
searchQuery, searchContext, CommentTerm.UPVOTE_COUNT, false);
addSearchTerm(
searchQuery, searchContext, CommentTerm.USER_HAS_UPVOTED, true);
addSearchTerm(searchQuery, searchContext, CommentTerm.PINGS, false);
// addSearchTerm(searchQuery, searchContext,
// CommentTerm.CREATED_BY_CURRENT_USER, false);
@SuppressWarnings("unchecked")
LinkedHashMap<String, Object> params =
(LinkedHashMap<String, Object>) searchContext.getAttribute(
"params");
if (params != null) {
String expandoAttributes = (String) params.get("expandoAttributes");
if (Validator.isNotNull(expandoAttributes)) {
addSearchExpando(searchQuery, searchContext, expandoAttributes);
}
}
}
示例11: postProcessContextBooleanFilter
import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
public void postProcessContextBooleanFilter(
BooleanFilter contextBooleanFilter, SearchContext searchContext)
throws Exception {
addStatus(contextBooleanFilter, searchContext);
// id
String id = (String) searchContext.getAttribute(DataManagerField.ID);
if (Validator.isNotNull(id)) {
contextBooleanFilter.addRequiredTerm(DataManagerField.ID, id);
}
// timestamp
long timestamp = GetterUtil.getLong(
searchContext.getAttribute(DataManagerField.TIMESTAMP));
if (timestamp > 0) {
contextBooleanFilter.addRequiredTerm("timestamp_Number_sortable",
timestamp);
}
// from- and until-date
Date fromDate = GetterUtil.getDate(
searchContext.getAttribute("fromDate"),
DateFormat.getDateInstance(), null);
Date untilDate = GetterUtil.getDate(
searchContext.getAttribute("untilDate"),
DateFormat.getDateInstance(), null);
long max = Long.MAX_VALUE;
long min = Long.MIN_VALUE;
if (fromDate != null) {
min = fromDate.getTime();
}
if (untilDate != null) {
max = untilDate.getTime();
}
contextBooleanFilter.addRangeTerm("timestamp_Number_sortable", min,
max);
}
示例12: postProcessFullQuery
import com.liferay.portal.kernel.search.SearchContext; //导入方法依赖的package包/类
@Override
protected void postProcessFullQuery(BooleanQuery fullQuery,
SearchContext searchContext) throws Exception {
// resolution - 15', 60', 360', 720'
String range = (String) searchContext.getAttribute("range");
String[] patterns = new String[] { "*0000", "*1500", "*3000", "*4500" }; // by
// default,
// filter
// timestamps
// with
// a
// 15'
// interval
if ("week".equals(range)) {
patterns = new String[] { "*0000" }; // 60' interval
} else if ("month".equals(range)) {
patterns = new String[] { "*000000", "*060000", "*120000",
"*180000" }; // 360' interval
} else if ("year".equals(range)) {
patterns = new String[] { "*000000", "*120000" }; // 720' interval
}
BooleanQuery booleanQuery = new BooleanQueryImpl();
for (String pattern : patterns) {
booleanQuery.add(new WildcardQueryImpl("timestamp", pattern),
BooleanClauseOccur.SHOULD);
}
fullQuery.add(booleanQuery, BooleanClauseOccur.MUST);
super.postProcessFullQuery(fullQuery, searchContext);
}