Search in sources :

Example 1 with MCRSolrURL

use of org.mycore.solr.search.MCRSolrURL in project mycore by MyCoRe-Org.

the class MCRSolrQueryResolver method resolve.

@Override
public Source resolve(String href, String base) throws TransformerException {
    String urlQuery = href.substring(href.indexOf(":") + 1);
    SolrClient solrClient = MCRSolrClientFactory.getSolrClient();
    MCRSolrURL solrURL = new MCRSolrURL((HttpSolrClient) solrClient, urlQuery);
    try {
        MCRURLContent result = new MCRURLContent(solrURL.getUrl());
        return result.getSource();
    } catch (IOException e) {
        throw new TransformerException("Unable to get input stream from solr: " + solrURL.getUrl(), e);
    }
}
Also used : HttpSolrClient(org.apache.solr.client.solrj.impl.HttpSolrClient) SolrClient(org.apache.solr.client.solrj.SolrClient) MCRSolrURL(org.mycore.solr.search.MCRSolrURL) MCRURLContent(org.mycore.common.content.MCRURLContent) IOException(java.io.IOException) TransformerException(javax.xml.transform.TransformerException)

Aggregations

IOException (java.io.IOException)1 TransformerException (javax.xml.transform.TransformerException)1 SolrClient (org.apache.solr.client.solrj.SolrClient)1 HttpSolrClient (org.apache.solr.client.solrj.impl.HttpSolrClient)1 MCRURLContent (org.mycore.common.content.MCRURLContent)1 MCRSolrURL (org.mycore.solr.search.MCRSolrURL)1