Example usage for com.liferay.portal.kernel.search SearchException SearchException

List of usage examples for com.liferay.portal.kernel.search SearchException SearchException

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.search SearchException SearchException.

Prototype

public SearchException(Throwable cause) 

Source Link

Usage

From source file:com.vportal.portlet.vcms.util.SearchIndexer.java

License:Open Source License

public void reindex(String[] ids) throws SearchException {
    try {/*from   w ww .  jav a2s.  c o m*/
        VcmsArticleServiceUtil.reIndex(ids);
    } catch (Exception e) {
        throw new SearchException(e);
    }
}

From source file:org.rsc.liferay.solr.SolrIndexSearcher.java

License:Open Source License

@Override
public Hits search(SearchContext searchContext, Query query) throws SearchException {

    try {//from ww  w.j a  v  a 2s .c  o  m
        return doSearch(searchContext, query);
    } catch (Exception e) {
        _log.error(e, e);

        throw new SearchException(e.getMessage());
    }
}

From source file:org.rsc.liferay.solr.SolrIndexSearcher.java

License:Open Source License

@Override
public Hits search(String searchEngineId, long companyId, Query query, Sort[] sorts, int start, int end)
        throws SearchException {

    try {/*  ww  w.  j ava  2s  .  c  o  m*/
        SolrQuery solrQuery = translateQuery(companyId, query, sorts, start, end);

        QueryResponse queryResponse = _solrServer.query(solrQuery, METHOD.POST);

        boolean allResults = false;

        if (solrQuery.getRows() == 0) {
            allResults = true;
        }

        return subset(solrQuery, query, query.getQueryConfig(), queryResponse, allResults);
    } catch (Exception e) {
        _log.error(e, e);

        if (!_swallowException) {
            throw new SearchException(e.getMessage());
        }

        return new HitsImpl();
    }
}

From source file:org.rsc.liferay.solr.SolrIndexWriter.java

License:Open Source License

@Override
public void addDocument(SearchContext searchContext, Document document) throws SearchException {

    try {/*from  w w w .j  av a 2s.c  o  m*/
        _solrServer.add(getSolrInputDocument(document));

        if (_commit) {
            _solrServer.commit();
        }
    } catch (Exception e) {
        _log.error(e, e);

        throw new SearchException(e.getMessage());
    }
}

From source file:org.rsc.liferay.solr.SolrIndexWriter.java

License:Open Source License

@Override
public void addDocuments(SearchContext searchContext, Collection<Document> documents) throws SearchException {

    try {/*  w  w w. j av  a 2  s.  co  m*/
        Collection<SolrInputDocument> solrInputDocuments = getSolrInputDocuments(documents);

        if (solrInputDocuments.isEmpty()) {
            return;
        }

        _solrServer.add(solrInputDocuments);

        if (_commit) {
            _solrServer.commit();
        }
    } catch (Exception e) {
        _log.error(e, e);

        throw new SearchException(e.getMessage());
    }
}

From source file:org.rsc.liferay.solr.SolrIndexWriter.java

License:Open Source License

@Override
public void deleteDocument(SearchContext searchContext, String uid) throws SearchException {

    try {/*  w  w w  .  j  a v a  2 s  . c  om*/
        _solrServer.deleteById(uid);

        if (_commit) {
            _solrServer.commit();
        }
    } catch (Exception e) {
        _log.error(e, e);

        throw new SearchException(e.getMessage());
    }
}

From source file:org.rsc.liferay.solr.SolrIndexWriter.java

License:Open Source License

@Override
public void deletePortletDocuments(SearchContext searchContext, String portletId) throws SearchException {

    try {//from   ww w  .  j a v a  2  s  .  c  om
        long companyId = searchContext.getCompanyId();

        StringBundler sb = null;

        if (companyId > 0) {
            sb = new StringBundler(9);

            sb.append(StringPool.PLUS);
            sb.append(Field.COMPANY_ID);
            sb.append(StringPool.COLON);
            sb.append(companyId);
            sb.append(StringPool.SPACE);
        }

        if (sb == null) {
            sb = new StringBundler(4);
        }

        sb.append(StringPool.PLUS);
        sb.append(Field.PORTLET_ID);
        sb.append(StringPool.COLON);
        sb.append(portletId);

        _solrServer.deleteByQuery(sb.toString());

        if (_commit) {
            _solrServer.commit();
        }
    } catch (Exception e) {
        _log.error(e, e);

        throw new SearchException(e.getMessage());
    }
}

From source file:org.xcolab.portlets.search.Indexer.java

License:Open Source License

@Override
public void reindex(String className, long classPK) throws SearchException {

    JournalArticle article;/*from ww  w . j  a v a  2s.c  o m*/
    try {
        article = JournalArticleLocalServiceUtil.getLatestArticle(classPK, WorkflowConstants.STATUS_APPROVED);

        reindex(article);
    } catch (PortalException e) {
        throw new SearchException(e);
    } catch (SystemException e) {
        throw new SearchException(e);
    }

}