1
|
package eu.dnetlib.data.search.solr;
|
2
|
|
3
|
import eu.dnetlib.api.DriverServiceException;
|
4
|
import eu.dnetlib.api.data.IndexService;
|
5
|
import eu.dnetlib.api.data.IndexServiceException;
|
6
|
import eu.dnetlib.domain.EPR;
|
7
|
import eu.dnetlib.domain.ServiceIdentity;
|
8
|
import eu.dnetlib.domain.data.Hint;
|
9
|
import eu.dnetlib.domain.enabling.Notification;
|
10
|
|
11
|
import java.util.List;
|
12
|
|
13
|
/**
|
14
|
* Created by antleb on 2/4/14.
|
15
|
*/
|
16
|
public class SolrIndexClient implements IndexService {
|
17
|
private String solrServerUrl = null;
|
18
|
|
19
|
private String interpretation = null;
|
20
|
|
21
|
@Override
|
22
|
public EPR indexLookup(String id, String query, String mdformat, String layout) throws IndexServiceException {
|
23
|
EPR epr = new EPR();
|
24
|
|
25
|
epr.setAddress(solrServerUrl);
|
26
|
epr.setParameter("action", "lookup");
|
27
|
epr.setParameter("id", id);
|
28
|
epr.setParameter("query", query);
|
29
|
epr.setParameter("mdformat", mdformat);
|
30
|
epr.setParameter("layout", layout);
|
31
|
epr.setParameter("interpretation", this.interpretation);
|
32
|
|
33
|
return epr;
|
34
|
}
|
35
|
|
36
|
@Override
|
37
|
public EPR getBrowsingStatistics(String query, String index, String mdFormatId, String layoutId) throws IndexServiceException {
|
38
|
EPR epr = new EPR();
|
39
|
|
40
|
epr.setAddress(solrServerUrl);
|
41
|
epr.setParameter("action", "browse");
|
42
|
epr.setParameter("id", index);
|
43
|
epr.setParameter("query", query);
|
44
|
epr.setParameter("mdformat", mdFormatId);
|
45
|
epr.setParameter("layout", layoutId);
|
46
|
epr.setParameter("interpretation", this.interpretation);
|
47
|
|
48
|
return epr;
|
49
|
}
|
50
|
|
51
|
public void newMethod(){}
|
52
|
|
53
|
public EPR getBrowsingStatistics2(String query, String index, String mdFormatId, String layoutId) throws IndexServiceException {
|
54
|
EPR epr = new EPR();
|
55
|
|
56
|
epr.setAddress(solrServerUrl);
|
57
|
epr.setParameter("action", "browse");
|
58
|
epr.setParameter("id", index);
|
59
|
epr.setParameter("query", query);
|
60
|
epr.setParameter("mdformat", mdFormatId);
|
61
|
epr.setParameter("layout", layoutId);
|
62
|
epr.setParameter("interpretation", this.interpretation);
|
63
|
|
64
|
return epr;
|
65
|
}
|
66
|
|
67
|
@Override
|
68
|
public Hint suggestiveSearch(String s, String s2, String s3, String s4, String s5) throws IndexServiceException {
|
69
|
throw new UnsupportedOperationException();
|
70
|
}
|
71
|
|
72
|
@Override
|
73
|
public List<String> getListOfIndices() throws IndexServiceException {
|
74
|
throw new UnsupportedOperationException();
|
75
|
}
|
76
|
|
77
|
@Override
|
78
|
public String getIndexStatistics(String s) throws IndexServiceException {
|
79
|
throw new UnsupportedOperationException();
|
80
|
}
|
81
|
|
82
|
@Override
|
83
|
public String getListOfIndicesCSV() throws IndexServiceException {
|
84
|
throw new UnsupportedOperationException();
|
85
|
}
|
86
|
|
87
|
@Override
|
88
|
public ServiceIdentity identify() {
|
89
|
throw new UnsupportedOperationException();
|
90
|
}
|
91
|
|
92
|
@Override
|
93
|
public void notify(Notification notification) throws DriverServiceException {
|
94
|
throw new UnsupportedOperationException();
|
95
|
}
|
96
|
|
97
|
public String getSolrServerUrl() {
|
98
|
return solrServerUrl;
|
99
|
}
|
100
|
|
101
|
public void setSolrServerUrl(String solrServerUrl) {
|
102
|
this.solrServerUrl = solrServerUrl;
|
103
|
}
|
104
|
|
105
|
public String getInterpretation() {
|
106
|
return interpretation;
|
107
|
}
|
108
|
|
109
|
public void setInterpretation(String interpretation) {
|
110
|
this.interpretation = interpretation;
|
111
|
}
|
112
|
}
|