Revision 55808
Added by Claudio Atzori almost 5 years ago
SolrIndexCollection.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.functionality.index; |
2 | 2 |
|
3 |
import java.io.IOException; |
|
4 |
import java.util.Collection; |
|
5 |
import java.util.Iterator; |
|
6 |
|
|
3 |
import com.google.common.base.Function; |
|
4 |
import com.google.common.collect.Iterators; |
|
5 |
import com.google.common.collect.Lists; |
|
6 |
import eu.dnetlib.data.provision.index.rmi.IndexServiceException; |
|
7 |
import eu.dnetlib.functionality.index.model.document.IndexDocument; |
|
8 |
import eu.dnetlib.functionality.index.query.SolrIndexDocument; |
|
9 |
import eu.dnetlib.functionality.index.utils.IndexFieldUtility; |
|
7 | 10 |
import org.apache.commons.lang3.StringUtils; |
8 | 11 |
import org.apache.commons.logging.Log; |
9 | 12 |
import org.apache.commons.logging.LogFactory; |
... | ... | |
11 | 14 |
import org.apache.solr.client.solrj.response.UpdateResponse; |
12 | 15 |
import org.apache.solr.common.SolrInputDocument; |
13 | 16 |
|
14 |
import com.google.common.base.Function;
|
|
15 |
import com.google.common.collect.Iterators;
|
|
16 |
import com.google.common.collect.Lists;
|
|
17 |
import java.io.IOException;
|
|
18 |
import java.util.Collection;
|
|
19 |
import java.util.Iterator;
|
|
17 | 20 |
|
18 |
import eu.dnetlib.data.provision.index.rmi.IndexServiceException; |
|
19 |
import eu.dnetlib.functionality.index.model.document.IndexDocument; |
|
20 |
import eu.dnetlib.functionality.index.model.util.SolrIndexDocument; |
|
21 |
import eu.dnetlib.functionality.index.utils.IndexFieldUtility; |
|
22 |
|
|
23 | 21 |
/** |
24 | 22 |
* The Class SolrIndexCollection. |
25 | 23 |
*/ |
... | ... | |
33 | 31 |
/** The Constant STATUS_INDEX_OK. */ |
34 | 32 |
public static final int STATUS_INDEX_OK = 0; |
35 | 33 |
|
36 |
/** The server. */
|
|
34 |
/** The client. */
|
|
37 | 35 |
private CloudSolrClient client; |
38 | 36 |
|
39 | 37 |
private boolean shutdown = false; |
... | ... | |
41 | 39 |
/** |
42 | 40 |
* The Constructor. |
43 | 41 |
* |
44 |
* @param client
|
|
42 |
* @param newServer
|
|
45 | 43 |
* the client |
46 | 44 |
*/ |
47 |
public SolrIndexCollection(final CloudSolrClient client) {
|
|
48 |
this.client = client;
|
|
45 |
public SolrIndexCollection(final CloudSolrClient newServer) {
|
|
46 |
this.client = newServer;
|
|
49 | 47 |
client.connect(); |
50 | 48 |
} |
51 | 49 |
|
... | ... | |
57 | 55 |
@Override |
58 | 56 |
public boolean add(final IndexDocument doc) throws IndexServiceException { |
59 | 57 |
if (isShutdown()) throw new IndexServiceException("Please get another SolrIndexCollection: this has been shut down"); |
58 |
|
|
60 | 59 |
final SolrIndexDocument solrDocument = (SolrIndexDocument) doc; |
61 | 60 |
try { |
62 | 61 |
final UpdateResponse response = client.add(solrDocument.getSolrDocument()); |
Also available in: Unified diff
reintegrated branch solr75 -r53828:HEAD