Project

General

Profile

« Previous | Next » 

Revision 48922

upgraded solr version to 6.6.0, inherit from snapshot parent

View differences:

modules/dnet-openaire-blacklist/trunk/src/main/java/eu/dnetlib/openaire/blacklist/OpenaireIdResolver.java
7 7
import org.apache.commons.logging.Log;
8 8
import org.apache.commons.logging.LogFactory;
9 9
import org.apache.solr.client.solrj.SolrQuery;
10
import org.apache.solr.client.solrj.impl.CloudSolrServer;
10
import org.apache.solr.client.solrj.impl.CloudSolrClient;
11 11
import org.apache.solr.client.solrj.response.QueryResponse;
12 12
import org.apache.solr.common.SolrDocument;
13 13
import org.apache.solr.common.SolrDocumentList;
......
47 47
	}
48 48

  
49 49
	protected List<String> findOriginalIds(final String id) {
50
		CloudSolrServer solrCore = null;
50

  
51 51
		final SolrQuery q = new SolrQuery("objidentifier:\"" + id + "\"");
52
		QueryResponse response = null;
53
		try {
54
			solrCore = new CloudSolrServer(getIndexEndpoint());
52

  
53
		try (final CloudSolrClient solrCore = new CloudSolrClient.Builder().withZkHost(getIndexEndpoint()).build()) {
55 54
			solrCore.setDefaultCollection(getPublicIndexCollection() + SOLR_COLLECTION_POSTFIX);
56
			response = solrCore.query(q);
55
			final QueryResponse response = solrCore.query(q);
57 56
			final SolrDocumentList results = response.getResults();
58 57
			if (results.isEmpty()) {
59 58
				log.debug("Query " + q + " returned 0 documents");
......
65 64
		} catch (final Exception e) {
66 65
			log.error("Can't get original ids for " + id + "\n ", e);
67 66
			throw new RuntimeException("Can't get original ids for " + id + "\n " + e);
68
		} finally {
69
			solrCore.shutdown();
70 67
		}
71 68
	}
72 69

  
modules/dnet-openaire-blacklist/trunk/pom.xml
3 3
    <parent>
4 4
        <groupId>eu.dnetlib</groupId>
5 5
        <artifactId>dnet45-parent</artifactId>
6
        <version>1.0.0</version>
6
        <version>1.0.0-SNAPSHOT</version>
7 7
        <relativePath />
8 8
    </parent>
9 9
    <modelVersion>4.0.0</modelVersion>

Also available in: Unified diff