Revision 53208
Added by Alessia Bardi over 5 years ago
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.CloudSolrClient;
|
|
10 |
import org.apache.solr.client.solrj.impl.CloudSolrServer;
|
|
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 |
|
|
50 |
CloudSolrServer solrCore = null; |
|
51 | 51 |
final SolrQuery q = new SolrQuery("objidentifier:\"" + id + "\""); |
52 |
|
|
53 |
try (final CloudSolrClient solrCore = new CloudSolrClient.Builder().withZkHost(getIndexEndpoint()).build()) { |
|
52 |
QueryResponse response = null; |
|
53 |
try { |
|
54 |
solrCore = new CloudSolrServer(getIndexEndpoint()); |
|
54 | 55 |
solrCore.setDefaultCollection(getPublicIndexCollection() + SOLR_COLLECTION_POSTFIX); |
55 |
final QueryResponse response = solrCore.query(q);
|
|
56 |
response = solrCore.query(q); |
|
56 | 57 |
final SolrDocumentList results = response.getResults(); |
57 | 58 |
if (results.isEmpty()) { |
58 | 59 |
log.debug("Query " + q + " returned 0 documents"); |
... | ... | |
64 | 65 |
} catch (final Exception e) { |
65 | 66 |
log.error("Can't get original ids for " + id + "\n ", e); |
66 | 67 |
throw new RuntimeException("Can't get original ids for " + id + "\n " + e); |
68 |
} finally { |
|
69 |
solrCore.shutdown(); |
|
67 | 70 |
} |
68 | 71 |
} |
69 | 72 |
|
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-SNAPSHOT</version>
|
|
6 |
<version>1.0.0</version> |
|
7 | 7 |
<relativePath /> |
8 | 8 |
</parent> |
9 | 9 |
<modelVersion>4.0.0</modelVersion> |
10 | 10 |
<groupId>eu.dnetlib</groupId> |
11 | 11 |
<artifactId>dnet-openaire-blacklist</artifactId> |
12 | 12 |
<packaging>jar</packaging> |
13 |
<version>1.2.0-SNAPSHOT</version>
|
|
13 |
<version>1.1.2-SNAPSHOT</version>
|
|
14 | 14 |
<scm> |
15 | 15 |
<developerConnection> |
16 | 16 |
scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-openaire-blacklist/trunk |
Also available in: Unified diff
Reverted to revision 48064. Use solr7 branch for new solr