本文整理汇总了Java中com.liferay.portal.kernel.search.IndexerRegistryUtil类的典型用法代码示例。如果您正苦于以下问题:Java IndexerRegistryUtil类的具体用法?Java IndexerRegistryUtil怎么用?Java IndexerRegistryUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IndexerRegistryUtil类属于com.liferay.portal.kernel.search包,在下文中一共展示了IndexerRegistryUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSortedRecords
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
private List<DDLRecord> getSortedRecords(final HttpServletRequest request, final DDLRecordSet recordSet,
final String sortByStructureColumnName) throws Exception {
DDMStructure structure = recordSet.getDDMStructure();
String indexedSortColumn = DDMIndexerUtil.encodeName(structure.getStructureId(), sortByStructureColumnName, Locale.US);
SearchContext searchContext = SearchContextFactory.getInstance(request);
String fieldType = structure.getFieldType(sortByStructureColumnName);
int sortType = getSortType(fieldType);
Sort sort = SortFactoryUtil.create(indexedSortColumn, sortType, false);
searchContext.setSorts(sort);
Indexer indexer = IndexerRegistryUtil.getIndexer("com.liferay.portlet.dynamicdatalists.util.DDLIndexer");
Hits results = indexer.search(searchContext);
return adapt(results);
}
示例2: searchLucene
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
public Hits searchLucene(LinkedHashMap<String, Object> params, Sort[] sorts, int start, int end,
SearchContext searchContext) throws ParseException, SearchException {
String keywords = (String) params.get(Field.KEYWORD_SEARCH);
String groupId = (String) params.get(Field.GROUP_ID);
Indexer<Registration> indexer = IndexerRegistryUtil.nullSafeGetIndexer(Registration.class);
searchContext.addFullQueryEntryClassName(CLASS_NAME);
searchContext.setEntryClassNames(new String[] { CLASS_NAME });
searchContext.setAttribute("paginationType", "regular");
searchContext.setLike(true);
searchContext.setStart(start);
searchContext.setEnd(end);
searchContext.setAndSearch(true);
searchContext.setSorts(sorts);
BooleanQuery booleanQuery = null;
if (Validator.isNotNull(keywords)) {
booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
} else {
booleanQuery = indexer.getFullQuery(searchContext);
}
if (Validator.isNotNull(groupId)) {
MultiMatchQuery query = new MultiMatchQuery(groupId);
query.addFields(Field.GROUP_ID);
booleanQuery.add(query, BooleanClauseOccur.MUST);
}
booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, CLASS_NAME);
return IndexSearcherHelperUtil.search(searchContext, booleanQuery);
}
示例3: isFilterSearch
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
private boolean isFilterSearch(SearchContext searchContext) {
if (searchContext.getEntryClassNames() == null) {
return false;
}
for (String entryClassName : searchContext.getEntryClassNames()) {
Indexer indexer = IndexerRegistryUtil.getIndexer(entryClassName);
if (indexer == null) {
continue;
}
if (indexer.isFilterSearch()) {
return true;
}
}
return false;
}
示例4: countLucense
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
public long countLucense(LinkedHashMap<String, Object> params, Sort[] sorts, int start, int end,
SearchContext searchContext) throws ParseException, SearchException {
String keywords = (String) params.get(Field.KEYWORD_SEARCH);
String groupId = (String) params.get(Field.GROUP_ID);
Indexer<Registration> indexer = IndexerRegistryUtil.nullSafeGetIndexer(Registration.class);
searchContext.addFullQueryEntryClassName(CLASS_NAME);
searchContext.setEntryClassNames(new String[] { CLASS_NAME });
searchContext.setAttribute("paginationType", "regular");
searchContext.setLike(true);
searchContext.setAndSearch(true);
BooleanQuery booleanQuery = null;
if (Validator.isNotNull(keywords)) {
booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
} else {
booleanQuery = indexer.getFullQuery(searchContext);
}
if (Validator.isNotNull(groupId)) {
MultiMatchQuery query = new MultiMatchQuery(groupId);
query.addFields(Field.GROUP_ID);
booleanQuery.add(query, BooleanClauseOccur.MUST);
}
booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, CLASS_NAME);
return IndexSearcherHelperUtil.searchCount(searchContext, booleanQuery);
}
示例5: updateProcessStepRole
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
public ProcessStepRole updateProcessStepRole(long processStepId, long roleId, boolean moderator, String condition) {
ProcessStepRolePK pk = new ProcessStepRolePK(processStepId, roleId);
ProcessStepRole processStepRole = processStepRolePersistence.fetchByPrimaryKey(pk);
if (Validator.isNull(processStepRole)) {
processStepRole = processStepRolePersistence.create(pk);
processStepRole.setModerator(moderator);
processStepRole.setCondition(condition);
} else {
processStepRole = processStepRolePersistence.fetchByPrimaryKey(pk);
processStepRole.setModerator(moderator);
processStepRole.setCondition(condition);
}
processStepRolePersistence.update(processStepRole);
// Update index
Indexer<ProcessStep> indexer = IndexerRegistryUtil.nullSafeGetIndexer(ProcessStep.class);
ProcessStep processStep = processStepPersistence.fetchByPrimaryKey(processStepId);
try {
indexer.reindex(processStep);
} catch (SearchException e) {
e.printStackTrace();
}
return processStepRole;
}
示例6: countLuceneSearchEngine
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
public long countLuceneSearchEngine(LinkedHashMap<String, Object> params,
SearchContext searchContext) throws ParseException, SearchException {
// TODO
MultiMatchQuery query = null;
String keywords = (String) params.get("keywords");
String groupId = (String) params.get("groupId");
String userId = (String) params.get("userId");
Indexer<OfficeSite> indexer = IndexerRegistryUtil.nullSafeGetIndexer(OfficeSite.class);
searchContext.addFullQueryEntryClassName(OfficeSite.class.getName());
searchContext.setEntryClassNames(new String[] { OfficeSite.class.getName() });
searchContext.setAttribute("paginationType", "regular");
searchContext.setLike(true);
searchContext.setAndSearch(true);
BooleanQuery booleanQuery = null;
booleanQuery = Validator.isNotNull((String) keywords)
? BooleanQueryFactoryUtil.create((SearchContext) searchContext) : indexer.getFullQuery(searchContext);
if (Validator.isNotNull(groupId)) {
query = new MultiMatchQuery(groupId);
query.addFields(OfficeSiteTerm.GROUP_ID);
booleanQuery.add(query, BooleanClauseOccur.MUST);
}
if (Validator.isNotNull(userId)) {
query = new MultiMatchQuery(userId);
query.addFields(OfficeSiteTerm.USER_ID);
booleanQuery.add(query, BooleanClauseOccur.MUST);
}
booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, OfficeSite.class.getName());
return IndexSearcherHelperUtil.searchCount(searchContext, booleanQuery);
}
示例7: getIndexer
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
/**
* Get indexer for the item class name.
*
* @param name
* of the item class
* @return indexer object
*/
protected Indexer<Object> getIndexer(String className) {
if (_indexerRegistry != null) {
return _indexerRegistry.getIndexer(className);
}
return IndexerRegistryUtil.getIndexer(className);
}
示例8: addPermissionsClassNameGroupIdFields
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
public void addPermissionsClassNameGroupIdFields(Data data)
throws SystemException {
String className = getPermissionsClassName(data);
long classPK = getPermissionsClassPK(data);
if (Validator.isNull(classPK) || Validator.isNull(className) ||
(classPK <= 0)) {
return;
}
Indexer indexer = IndexerRegistryUtil.getIndexer(className);
if (!indexer.isPermissionAware()) {
return;
}
long groupId = 0L;
Object groupIdObj = data.get("groupId", 0L);
if (groupIdObj instanceof Number) {
groupId = ((Number)groupIdObj).longValue();
Group group = GroupLocalServiceUtil.fetchGroup(groupId);
if ((group != null) && group.isLayout()) {
groupId = group.getParentGroupId();
}
}
data.set("permissionsClassName", className);
data.set("permissionsClassPK", classPK);
data.set("permissionsGroupId", groupId);
}
示例9: hasIndexerEnabled
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
public static boolean hasIndexerEnabled(String className) {
Object indexer = IndexerRegistryUtil.getIndexer(className);
if (indexer == null) {
return false;
}
if (indexer instanceof Proxy) {
try {
ClassLoaderBeanHandler classLoaderBeanHandler =
(ClassLoaderBeanHandler)
Proxy.getInvocationHandler(indexer);
indexer = classLoaderBeanHandler.getBean();
if (indexer == null) {
return false;
}
}
catch (Exception e) {
if (_log.isDebugEnabled()) {
_log.debug(e, e);
}
}
}
if (indexer instanceof BaseIndexer) {
BaseIndexer baseIndexer = (BaseIndexer)indexer;
return baseIndexer.isIndexerEnabled();
}
return false;
}
示例10: delete
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
public void delete(Data value) throws SearchException {
Object uid = value.get(Field.UID);
if (uid == null) {
return;
}
String className = value.getEntryClassName();
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(className);
indexer.delete(value.getCompanyId(), uid.toString());
}
示例11: reindexAllIndices
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
protected static void reindexAllIndices(final Class modelClass, final long id) {
Indexer indexer = IndexerRegistryUtil.getIndexer(modelClass);
try {
indexer.reindex(modelClass.getName(), id);
} catch (SearchException e) {
e.printStackTrace();
}
}
示例12: deleteApplication
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
public Application deleteApplication(Application application) throws SystemException {
_log.debug("deleteApplication: " + application.getApplicationId());
// Indexer
Indexer indexer = IndexerRegistryUtil.getIndexer(Application.class);
try {
indexer.delete(application);
} catch (SearchException e) {
e.printStackTrace();
}
applicationPersistence.remove(application);
return application;
}
示例13: getPermissionQuery
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
private Query getPermissionQuery(SearchContext searchContext, Query query) {
if (searchContext.getEntryClassNames() == null) {
return query;
}
for (String className : searchContext.getEntryClassNames()) {
Indexer indexer = IndexerRegistryUtil.getIndexer(className);
if (indexer != null) {
if (indexer.isFilterSearch() && indexer.isPermissionAware()) {
SearchPermissionChecker searchPermissionChecker = SearchEngineUtil.getSearchPermissionChecker();
query = searchPermissionChecker.getPermissionQuery(searchContext.getCompanyId(), searchContext.getGroupIds(), searchContext.getUserId(), className, query, searchContext);
}
}
}
return query;
}
示例14: removeServiceProcessRole
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
public ServiceProcessRole removeServiceProcessRole(long serviceProcessId, long roleId) {
ServiceProcessRolePK pk = new ServiceProcessRolePK(serviceProcessId, roleId);
ServiceProcessRole serviceProcessRole = serviceProcessRolePersistence.fetchByPrimaryKey(pk);
serviceProcessRolePersistence.remove(serviceProcessRole);
//Update Index
Indexer<ServiceProcess> indexer = IndexerRegistryUtil.nullSafeGetIndexer(ServiceProcess.class);
ServiceProcess serviceProcess = serviceProcessPersistence.fetchByPrimaryKey(serviceProcessId);
try {
indexer.reindex(serviceProcess);
} catch (SearchException e) {
e.printStackTrace();
}
return serviceProcessRole;
}
示例15: removeProcessStepRole
import com.liferay.portal.kernel.search.IndexerRegistryUtil; //导入依赖的package包/类
public ProcessStepRole removeProcessStepRole(long processStepId, long roleId) {
ProcessStepRolePK pk = new ProcessStepRolePK(processStepId, roleId);
ProcessStepRole processStepRole = processStepRolePersistence.fetchByPrimaryKey(pk);
processStepRolePersistence.remove(processStepRole);
// Update index
Indexer<ProcessStep> indexer = IndexerRegistryUtil.nullSafeGetIndexer(ProcessStep.class);
ProcessStep processStep = processStepPersistence.fetchByPrimaryKey(processStepId);
try {
indexer.reindex(processStep);
} catch (SearchException e) {
e.printStackTrace();
}
return processStepRole;
}