List of usage examples for com.liferay.portal.kernel.search Field USER_ID
String USER_ID
To view the source code for com.liferay.portal.kernel.search Field USER_ID.
Click Source Link
From source file:com.vportal.portlet.vcms.service.impl.VcmsArticleServiceImpl.java
License:Open Source License
public Hits search(long companyId, long groupId, long userId, String keywords, int start, int end) throws SystemException { try {/*w ww . ja v a 2 s .co m*/ BooleanQuery contextQuery = BooleanQueryFactoryUtil.create(); contextQuery.addRequiredTerm(Field.PORTLET_ID, PortletKeysExt.VCMS); if (groupId > 0) { contextQuery.addRequiredTerm(Field.GROUP_ID, groupId); } if (userId > 0) { contextQuery.addRequiredTerm(Field.USER_ID, userId); } BooleanQuery searchQuery = BooleanQueryFactoryUtil.create(); if (Validator.isNotNull(keywords)) { searchQuery.addTerm(Field.TITLE, keywords); searchQuery.addTerm(Field.DESCRIPTION, keywords); searchQuery.addTerm(Field.CONTENT, keywords); /*searchQuery.addTerm(Field.TAGS_ENTRIES, keywords);*/ searchQuery.addTerm(Field.ASSET_TAG_NAMES, keywords); } BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(); fullQuery.add(contextQuery, BooleanClauseOccur.MUST); if (searchQuery.clauses().size() > 0) { fullQuery.add(searchQuery, BooleanClauseOccur.MUST); } return SearchEngineUtil.search(companyId, fullQuery, start, end); } catch (Exception e) { throw new SystemException(e); } }
From source file:com.vportal.portlet.vfaq.service.impl.FAQQuestionLocalServiceImpl.java
License:Open Source License
public Hits search(long companyId, long groupId, long userId, String keywords, int start, int end) throws SystemException { try {// w ww. j a va 2 s . co m BooleanQuery contextQuery = BooleanQueryFactoryUtil.create(); contextQuery.addRequiredTerm(Field.PORTLET_ID, PortletKeysExt.FAQ_QUESTION); if (groupId > 0) { contextQuery.addRequiredTerm(Field.GROUP_ID, groupId); } if (userId > 0) { contextQuery.addRequiredTerm(Field.USER_ID, userId); } BooleanQuery searchQuery = BooleanQueryFactoryUtil.create(); if (Validator.isNotNull(keywords)) { searchQuery.addTerm(Field.TITLE, keywords); searchQuery.addTerm(Field.CONTENT, keywords); /*searchQuery.addTerm(Field.TAGS_ENTRIES, keywords);*/ } BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(); fullQuery.add(contextQuery, BooleanClauseOccur.MUST); if (searchQuery.clauses().size() > 0) { fullQuery.add(searchQuery, BooleanClauseOccur.MUST); } return SearchEngineUtil.search(companyId, fullQuery, start, end); } catch (Exception e) { throw new SystemException(e); } }
From source file:com.vportal.portlet.vlegal.service.impl.VLegalDocumentServiceImpl.java
License:Open Source License
public Hits search(long companyId, long groupId, long userId, String keywords, int start, int end) throws SystemException { try {/*from w ww .j a va 2 s .co m*/ BooleanQuery contextQuery = BooleanQueryFactoryUtil.create(); contextQuery.addRequiredTerm(Field.PORTLET_ID, PortletKeysExt.VLEGAL); if (groupId > 0) { contextQuery.addRequiredTerm(Field.GROUP_ID, groupId); } if (userId > 0) { contextQuery.addRequiredTerm(Field.USER_ID, userId); } BooleanQuery searchQuery = BooleanQueryFactoryUtil.create(); if (Validator.isNotNull(keywords)) { searchQuery.addTerm(Field.TITLE, keywords); searchQuery.addTerm(Field.CONTENT, keywords); searchQuery.addTerm(Field.ASSET_TAG_NAMES, keywords); } BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(); fullQuery.add(contextQuery, BooleanClauseOccur.MUST); if (searchQuery.clauses().size() > 0) { fullQuery.add(searchQuery, BooleanClauseOccur.MUST); } return SearchEngineUtil.search(companyId, fullQuery, start, end); } catch (Exception e) { throw new SystemException(e); } }
From source file:org.apache.jsp.html.portlet.enterprise_005fadmin.view_005fusers_jsp.java
License:Open Source License
private static List<User> _getResults(Hits hits) throws Exception { List<User> users = new ArrayList<User>(); List<Document> hitsList = hits.toList(); for (Document doc : hitsList) { long userId = GetterUtil.getLong(doc.get(Field.USER_ID)); try { users.add(UserLocalServiceUtil.getUserById(userId)); } catch (NoSuchUserException nsue) { _log.error("User " + userId + " does not exist in the search index. Please reindex."); }/*from w w w . j ava2s .com*/ } return users; }