List of usage examples for com.liferay.portal.kernel.search SearchException SearchException
public SearchException(String msg, Throwable cause)
From source file:org.rsc.liferay.solr.SolrSpellCheckIndexWriter.java
License:Open Source License
@Override public void clearQuerySuggestionDictionaryIndexes(SearchContext searchContext) throws SearchException { String deleteQuery = buildDeleteQuery(searchContext, SuggestionConstants.TYPE_QUERY_SUGGESTION); try {/*from w ww .j a va 2s. com*/ _solrServer.deleteByQuery(deleteQuery); if (_commit) { _solrServer.commit(); } } catch (Exception e) { if (_log.isDebugEnabled()) { _log.debug(e, e); } throw new SearchException(e.getMessage(), e); } }
From source file:org.rsc.liferay.solr.SolrSpellCheckIndexWriter.java
License:Open Source License
@Override public void clearSpellCheckerDictionaryIndexes(SearchContext searchContext) throws SearchException { String deleteQuery = buildDeleteQuery(searchContext, SuggestionConstants.TYPE_SPELL_CHECKER); try {//from w w w .j a va 2s.c o m _solrServer.deleteByQuery(deleteQuery); if (_commit) { _solrServer.commit(); } } catch (Exception e) { if (_log.isDebugEnabled()) { _log.debug(e, e); } throw new SearchException(e.getMessage(), e); } }
From source file:org.xcolab.portlets.discussions.Indexer.java
License:Open Source License
@Override public void reindex(String[] ids) throws SearchException { long companyId = GetterUtil.getLong(ids[0]); List<DiscussionMessage> messages = null; try {/* ww w .ja v a2 s . c om*/ messages = DiscussionMessageLocalServiceUtil.getDiscussionMessages(0, Integer.MAX_VALUE); } catch (SystemException e) { _log.error("Can't reindex plans", e); throw new SearchException("Can't reindex plans", e); } Collection<Document> documents = new ArrayList<Document>(); for (DiscussionMessage message : messages) { if (message.getDeleted() != null) continue; try { if (DiscussionCategoryGroupLocalServiceUtil.getDiscussionCategoryGroup(message.getCategoryGroupId()) .isIsQuiet()) { continue; } } catch (PortalException e1) { _log.error("Can't find discussion category group: " + message.getCategoryGroupId(), e1); } catch (SystemException e1) { _log.error("Can't find discussion category group: " + message.getCategoryGroupId(), e1); } try { Document document = getDocument(message); documents.add(document); } catch (SearchException e) { _log.error("An exception has been thrown when reindexing plan with id: " + message.getMessageId(), e); } } SearchEngineUtil.updateDocuments(getSearchEngineId(), companyId, documents); }
From source file:org.xcolab.portlets.search.Indexer.java
License:Open Source License
@Override public void reindex(String[] ids) throws SearchException { long companyId = GetterUtil.getLong(ids[0]); List<JournalArticle> articles = null; try {//from www . j a va 2 s . co m articles = JournalArticleLocalServiceUtil.getJournalArticles(0, Integer.MAX_VALUE); } catch (SystemException e) { _log.error("Can't reindex plans", e); throw new SearchException("Can't reindex plans", e); } Collection<Document> documents = new ArrayList<Document>(); for (JournalArticle article : articles) { try { Document document = getDocument(article); documents.add(document); } catch (SearchException e) { _log.error( "An exception has been thrown when reindexing article with id: " + article.getArticleId(), e); } } SearchEngineUtil.updateDocuments(getSearchEngineId(), companyId, documents); }