Project

General

Profile

« Previous | Next » 

Revision 53803

branch for solr 7.5.0

View differences:

modules/dnet-openaireplus-mapping-utils/branches/solr75/src/main/java/eu/dnetlib/data/index/CloudIndexClientFactory.java
1 1
package eu.dnetlib.data.index;
2 2

  
3
import eu.dnetlib.functionality.index.utils.ZkServers;
3 4
import org.apache.commons.logging.Log;
4 5
import org.apache.commons.logging.LogFactory;
5
import org.apache.solr.client.solrj.impl.CloudSolrServer;
6
import org.apache.solr.client.solrj.impl.CloudSolrClient;
6 7
import org.apache.solr.client.solrj.response.SolrPingResponse;
7 8

  
8 9
/**
......
15 16
	public static CloudIndexClient newIndexClient(final String baseURL, final String collection, final boolean parallelUpdates)
16 17
			throws CloudIndexClientException {
17 18
		try {
18
			final CloudSolrServer client = new CloudSolrServer(baseURL);
19

  
20 19
			log.info(String.format("Initializing solr server (%s) ...", baseURL));
21 20

  
21
			final ZkServers zk = ZkServers.newInstance(baseURL);
22
			final CloudSolrClient client = new CloudSolrClient.Builder(zk.getHosts(), zk.getChroot())
23
					.withParallelUpdates(parallelUpdates)
24
					.build();
25

  
22 26
			client.connect();
23

  
24
			client.setParallelUpdates(parallelUpdates);
25 27
			client.setDefaultCollection(collection);
26 28

  
27 29
			final SolrPingResponse rsp = client.ping();
modules/dnet-openaireplus-mapping-utils/branches/solr75/src/main/java/eu/dnetlib/data/index/CloudIndexClient.java
1 1
package eu.dnetlib.data.index;
2 2

  
3
import java.io.Closeable;
4
import java.io.IOException;
5
import java.text.SimpleDateFormat;
6
import java.util.Date;
7
import java.util.List;
8

  
9 3
import eu.dnetlib.functionality.index.solr.feed.StreamingInputDocumentFactory;
10 4
import eu.dnetlib.miscutils.datetime.HumanTime;
11 5
import eu.dnetlib.miscutils.functional.UnaryFunction;
12 6
import org.apache.commons.logging.Log;
13 7
import org.apache.commons.logging.LogFactory;
14 8
import org.apache.solr.client.solrj.SolrQuery;
15
import org.apache.solr.client.solrj.impl.CloudSolrServer;
9
import org.apache.solr.client.solrj.impl.CloudSolrClient;
16 10
import org.apache.solr.client.solrj.response.QueryResponse;
17 11
import org.apache.solr.client.solrj.response.UpdateResponse;
18 12
import org.apache.solr.common.SolrInputDocument;
19 13

  
14
import java.io.Closeable;
15
import java.io.IOException;
16
import java.text.SimpleDateFormat;
17
import java.util.Date;
18
import java.util.List;
19

  
20 20
/**
21 21
 * Created by michele on 11/11/15.
22 22
 */
......
25 25
	private static final Log log = LogFactory.getLog(CloudIndexClient.class);
26 26
	private static final String INDEX_RECORD_RESULT_FIELD = "dnetResult";
27 27

  
28
	private final CloudSolrServer solrClient;
28
	private final CloudSolrClient solrClient;
29 29

  
30
	protected CloudIndexClient(final CloudSolrServer solrServer) {
30
	protected CloudIndexClient(final CloudSolrClient solrServer) {
31 31
		this.solrClient = solrServer;
32 32
	}
33 33

  
......
152 152

  
153 153
	public void close() throws IOException {
154 154
		if (solrClient != null) {
155
			solrClient.shutdown();
155
			solrClient.close();
156 156
		}
157 157
	}
158 158

  
modules/dnet-openaireplus-mapping-utils/branches/solr75/pom.xml
12 12
	<packaging>jar</packaging>
13 13
	<version>6.2.20-solr75-SNAPSHOT</version>
14 14
	<scm>
15
		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-openaireplus-mapping-utils/trunk</developerConnection>
15
		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-openaireplus-mapping-utils/branches/solr75</developerConnection>
16 16
	</scm>
17 17

  
18 18
	<properties>

Also available in: Unified diff