4 |
4 |
import java.util.List;
|
5 |
5 |
import java.util.Set;
|
6 |
6 |
import java.util.stream.Collectors;
|
7 |
|
|
8 |
7 |
import javax.annotation.Resource;
|
9 |
8 |
|
10 |
|
import org.apache.commons.lang.StringUtils;
|
11 |
|
import org.apache.commons.logging.Log;
|
12 |
|
import org.apache.commons.logging.LogFactory;
|
13 |
|
import org.springframework.beans.factory.annotation.Autowired;
|
14 |
|
import org.springframework.core.io.ClassPathResource;
|
15 |
|
import org.springframework.stereotype.Controller;
|
16 |
|
import org.springframework.ui.ModelMap;
|
17 |
|
import org.springframework.web.bind.annotation.RequestMapping;
|
18 |
|
import org.springframework.web.bind.annotation.RequestMethod;
|
19 |
|
import org.springframework.web.bind.annotation.RequestParam;
|
20 |
|
import org.springframework.web.bind.annotation.ResponseBody;
|
21 |
|
|
22 |
|
import com.google.common.base.Function;
|
23 |
9 |
import com.google.common.collect.Lists;
|
24 |
10 |
import com.google.common.collect.Sets;
|
25 |
11 |
import com.google.gson.Gson;
|
26 |
12 |
import com.google.gson.reflect.TypeToken;
|
27 |
|
|
28 |
13 |
import eu.dnetlib.data.provision.index.rmi.IndexServiceException;
|
29 |
14 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
|
30 |
15 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
|
31 |
16 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
|
32 |
17 |
import eu.dnetlib.functionality.index.client.IndexClient;
|
33 |
18 |
import eu.dnetlib.functionality.index.client.IndexClientException;
|
34 |
|
import eu.dnetlib.functionality.index.client.ResolvingIndexClientFactory;
|
35 |
19 |
import eu.dnetlib.functionality.index.client.response.BrowseEntry;
|
36 |
20 |
import eu.dnetlib.functionality.index.client.response.LookupResponse;
|
|
21 |
import eu.dnetlib.functionality.index.client.solr.SolrIndexClientFactory;
|
37 |
22 |
import eu.dnetlib.functionality.modular.ui.AbstractAjaxController;
|
38 |
23 |
import eu.dnetlib.functionality.modular.ui.index.models.IndexInfo;
|
39 |
24 |
import eu.dnetlib.functionality.modular.ui.index.models.MdFormatInfo;
|
40 |
25 |
import eu.dnetlib.miscutils.functional.xml.ApplyXslt;
|
|
26 |
import org.apache.commons.lang.StringUtils;
|
|
27 |
import org.apache.commons.logging.Log;
|
|
28 |
import org.apache.commons.logging.LogFactory;
|
|
29 |
import org.springframework.beans.factory.annotation.Autowired;
|
|
30 |
import org.springframework.core.io.ClassPathResource;
|
|
31 |
import org.springframework.stereotype.Controller;
|
|
32 |
import org.springframework.ui.ModelMap;
|
|
33 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
34 |
import org.springframework.web.bind.annotation.RequestMethod;
|
|
35 |
import org.springframework.web.bind.annotation.RequestParam;
|
|
36 |
import org.springframework.web.bind.annotation.ResponseBody;
|
41 |
37 |
|
42 |
38 |
/**
|
43 |
39 |
* The Class IndexServiceInternalController.
|
... | ... | |
54 |
50 |
|
55 |
51 |
/** The index client factory. */
|
56 |
52 |
@Autowired
|
57 |
|
private ResolvingIndexClientFactory indexClientFactory;
|
|
53 |
private SolrIndexClientFactory indexClientFactory;
|
58 |
54 |
|
59 |
55 |
@Autowired
|
60 |
56 |
private IndexClientMap clientMap;
|
... | ... | |
86 |
82 |
/**
|
87 |
83 |
* Index datastructures.
|
88 |
84 |
*
|
89 |
|
* @param map
|
90 |
|
* the map
|
91 |
85 |
* @param backend
|
92 |
86 |
* the backend
|
93 |
87 |
* @return the list< index info>
|
... | ... | |
112 |
106 |
/**
|
113 |
107 |
* Md format info.
|
114 |
108 |
*
|
115 |
|
* @param map
|
116 |
|
* the map
|
117 |
109 |
* @param id
|
118 |
110 |
* the id
|
119 |
111 |
* @param layout
|
... | ... | |
137 |
129 |
/**
|
138 |
130 |
* Gets the backend available.
|
139 |
131 |
*
|
140 |
|
* @param map
|
141 |
|
* the map
|
142 |
|
* @param id
|
143 |
|
* the id
|
144 |
|
* @param layout
|
145 |
|
* the layout
|
146 |
132 |
* @return the backend available
|
147 |
133 |
* @throws Exception
|
148 |
134 |
* the exception
|
... | ... | |
192 |
178 |
}
|
193 |
179 |
}
|
194 |
180 |
|
195 |
|
String indexClientKeys = backend + "-" + format + "-" + layout + "-" + interpretation;
|
|
181 |
String indexClientKeys = format + "-" + layout + "-" + interpretation;
|
196 |
182 |
|
197 |
183 |
IndexClient client = null;
|
198 |
184 |
if (clientMap.getMap().containsKey(indexClientKeys)) {
|
199 |
185 |
client = clientMap.getMap().get(indexClientKeys);
|
200 |
186 |
} else {
|
201 |
|
client = indexClientFactory.getClient(format, layout, interpretation, backend);
|
|
187 |
client = indexClientFactory.getClient(format, layout, interpretation);
|
202 |
188 |
clientMap.getMap().put(indexClientKeys, client);
|
203 |
189 |
}
|
204 |
190 |
|
... | ... | |
218 |
204 |
@RequestParam(value = "query", required = true) final String query,
|
219 |
205 |
@RequestParam(value = "indexidentifier", required = false) final String indexId) throws IndexServiceException {
|
220 |
206 |
|
221 |
|
String indexClientKeys = backend + "-" + format + "-" + layout + "-" + interpretation;
|
|
207 |
String indexClientKeys = format + "-" + layout + "-" + interpretation;
|
222 |
208 |
|
223 |
209 |
IndexClient client = null;
|
224 |
210 |
if (clientMap.getMap().containsKey(indexClientKeys)) {
|
225 |
211 |
client = clientMap.getMap().get(indexClientKeys);
|
226 |
212 |
} else {
|
227 |
|
client = indexClientFactory.getClient(format, layout, interpretation, backend);
|
|
213 |
client = indexClientFactory.getClient(format, layout, interpretation);
|
228 |
214 |
clientMap.getMap().put(indexClientKeys, client);
|
229 |
215 |
}
|
230 |
216 |
String mquery = query;
|
... | ... | |
250 |
236 |
|
251 |
237 |
) throws IndexClientException {
|
252 |
238 |
|
253 |
|
String indexClientKeys = backend + "-" + format + "-" + layout + "-" + interpretation;
|
|
239 |
String indexClientKeys = format + "-" + layout + "-" + interpretation;
|
254 |
240 |
|
255 |
241 |
log.debug(indexClientKeys);
|
256 |
242 |
|
257 |
243 |
IndexClient client = null;
|
258 |
244 |
|
259 |
245 |
if (!clientMap.getMap().containsKey(indexClientKeys)) {
|
260 |
|
clientMap.getMap().put(indexClientKeys, indexClientFactory.getClient(format, layout, interpretation, backend));
|
|
246 |
clientMap.getMap().put(indexClientKeys, indexClientFactory.getClient(format, layout, interpretation));
|
261 |
247 |
}
|
262 |
248 |
client = clientMap.getMap().get(indexClientKeys);
|
263 |
249 |
|
reintegrated branch solr75 -r53828:HEAD