Project

General

Profile

« Previous | Next » 

Revision 57157

Added by Enrico Ottonello over 4 years ago

solr 772 integration

View differences:

SolrIndexClient.java
1 1
package eu.dnetlib.index.solr.client;
2 2

  
3 3
import java.io.IOException;
4
import java.text.SimpleDateFormat;
4 5
import java.util.ArrayList;
6
import java.util.Date;
5 7
import java.util.HashMap;
6 8
import java.util.List;
7 9
import java.util.Map;
10
import java.util.function.Function;
8 11

  
12
import org.apache.commons.lang3.StringUtils;
13
import org.apache.commons.logging.Log;
14
import org.apache.commons.logging.LogFactory;
15
import org.apache.solr.client.solrj.SolrClient;
16
import org.apache.solr.client.solrj.SolrQuery;
17
import org.apache.solr.client.solrj.SolrServerException;
18
import org.apache.solr.client.solrj.impl.CloudSolrClient;
19
import org.apache.solr.client.solrj.request.LukeRequest;
20
import org.apache.solr.client.solrj.response.LukeResponse;
21
import org.apache.solr.client.solrj.response.LukeResponse.FieldInfo;
22
import org.apache.solr.client.solrj.response.QueryResponse;
23
import org.apache.solr.client.solrj.response.UpdateResponse;
24
import org.apache.solr.common.SolrInputDocument;
25

  
9 26
import com.google.common.collect.BiMap;
10 27
import com.google.common.collect.Maps;
11
import eu.dnetlib.clients.index.client.AbstractIndexClient;
28

  
12 29
import eu.dnetlib.clients.index.client.IndexClient;
13 30
import eu.dnetlib.clients.index.client.IndexClientException;
14 31
import eu.dnetlib.clients.index.client.response.BrowseEntry;
......
19 36
import eu.dnetlib.clients.index.query.QueryLanguage;
20 37
import eu.dnetlib.clients.index.query.QueryResponseFactory;
21 38
import eu.dnetlib.clients.index.query.QueryResponseParser;
22
import eu.dnetlib.utils.MetadataReference;
23 39
import eu.dnetlib.cql.CqlValueTransformerMap;
24 40
import eu.dnetlib.index.query.SolrIndexQuery;
25 41
import eu.dnetlib.index.query.SolrIndexQueryFactory;
26 42
import eu.dnetlib.index.query.SolrIndexQueryResponse;
27 43
import eu.dnetlib.index.solr.cql.SolrTypeBasedCqlValueTransformerMapFactory;
44
import eu.dnetlib.index.solr.feed.StreamingInputDocumentFactory;
45
import eu.dnetlib.index.utils.ZkServers;
46
import eu.dnetlib.miscutils.datetime.HumanTime;
28 47
import eu.dnetlib.rmi.provision.BrowsingRow;
29 48
import eu.dnetlib.rmi.provision.GroupResult;
30
import org.apache.commons.logging.Log;
31
import org.apache.commons.logging.LogFactory;
32
import org.apache.solr.client.solrj.SolrServerException;
33
import org.apache.solr.client.solrj.impl.CloudSolrClient;
34
import org.apache.solr.client.solrj.request.LukeRequest;
35
import org.apache.solr.client.solrj.response.LukeResponse;
36
import org.apache.solr.client.solrj.response.LukeResponse.FieldInfo;
37
import org.apache.solr.client.solrj.response.LukeResponse.FieldTypeInfo;
38
import org.apache.solr.client.solrj.response.QueryResponse;
49
import eu.dnetlib.rmi.provision.IndexServiceException;
50
import eu.dnetlib.utils.MetadataReference;
39 51

  
40 52
/**
41 53
 * The Class SolrIndexClient.
42 54
 */
43
public class SolrIndexClient extends AbstractIndexClient implements IndexClient {
55
public class SolrIndexClient implements IndexClient {
44 56

  
45 57
	private static final Log log = LogFactory.getLog(SolrIndexClient.class);
46
	/**
47
	 * The server.
48
	 */
58

  
59
	private static final String INDEX_RECORD_RESULT_FIELD = "dnetResult";
60

  
61
	private static String ZK_ADDRESS = "address";
62

  
63
	/** The format. */
64
	private String format;
65

  
66
	/** The layout. */
67
	private String layout;
68

  
69
	/** The interpretation. */
70
	private String interpretation;
71

  
72
	protected Map<String, String> serviceProperties;
73

  
74
	/** The client. */
49 75
	private CloudSolrClient client;
76

  
50 77
	private SolrIndexQueryFactory solrIndexQueryFactory;
51
	/**
52
	 * The query response factory.
53
	 */
78

  
79
	/** The query response factory. */
54 80
	private QueryResponseFactory<QueryResponse> queryResponseFactory;
81

  
55 82
	private SolrTypeBasedCqlValueTransformerMapFactory tMapFactory;
56 83

  
57 84
	/**
58 85
	 * The Constructor.
59 86
	 *
60
	 * @param format            the format
61
	 * @param layout            the layout
62
	 * @param interpretation    the interpretation
63
	 * @param serviceProperties the service properties
87
	 * @param format
88
	 *            the format
89
	 * @param layout
90
	 *            the layout
91
	 * @param interpretation
92
	 *            the interpretation
93
	 * @param serviceProperties
94
	 *            the service properties
64 95
	 * @param tMapFactory
65 96
	 */
66 97
	public SolrIndexClient(final String format, final String layout, final String interpretation, final Map<String, String> serviceProperties,
67 98
			final SolrIndexQueryFactory indexQueryFactory, final QueryResponseFactory<QueryResponse> queryResponseFactory,
68 99
			final SolrTypeBasedCqlValueTransformerMapFactory tMapFactory) {
69
		super(format, layout, interpretation, serviceProperties);
70

  
71
		log.debug(String.format("Created a new instance of the index of type %s-%s-%s", format, layout, interpretation));
100
		this.format = format;
101
		this.layout = layout;
102
		this.interpretation = interpretation;
103
		this.serviceProperties = serviceProperties;
72 104
		this.solrIndexQueryFactory = indexQueryFactory;
73 105
		this.queryResponseFactory = queryResponseFactory;
74 106
		this.tMapFactory = tMapFactory;
75 107

  
108
		log.debug(String.format("Created a new instance of the index of type %s-%s-%s", format, layout, interpretation));
76 109
	}
77 110

  
78
	public static Map<String, ValueType> getStringValueTypeMap(final Map<String, FieldInfo> fieldInfos, final Map<String, FieldTypeInfo> fieldTypeInfos) {
79
		final Map<String, ValueType> result = Maps.newHashMap();
80
		for (FieldInfo fieldInfo : fieldInfos.values()) {
81
			FieldTypeInfo fieldTypeInfo = fieldTypeInfos.get(fieldInfo.getType());
82
			final String fieldName = fieldTypeInfo.getName().toLowerCase();
83
			final ValueType fieldType = resolveSolrTypeClassName(fieldName);
84
			result.put(fieldInfo.getName(), fieldType);
85
		}
86
		return result;
87
	}
88

  
89
	private static ValueType resolveSolrTypeClassName(final String solrTypeName) {
90
		if (solrTypeName.contains("LongField")) {
91
			return ValueType.LONG;
92
		} else if (solrTypeName.contains("IntField")) {
93
			return ValueType.LONG;
94
		} else if (solrTypeName.contains("short")) {
95
			return ValueType.LONG;
96
		} else if (solrTypeName.contains("float")) {
97
			return ValueType.DOUBLE;
98
		} else if (solrTypeName.contains("double")) {
99
			return ValueType.DOUBLE;
100
		} else if (solrTypeName.contains("date")) {
101
			return ValueType.DATETIME;
102
		} else {
103
			return ValueType.STRING;
104
		}
105
	}
106

  
107 111
	/**
108 112
	 * Do delete.
109 113
	 *
110
	 * @param query the CQL query
114
	 * @param query
115
	 *            the CQL query
111 116
	 * @return true, if do delete
112
	 * @throws IndexClientException the index service exception
117
	 * @throws IndexServiceException
118
	 *             the index service exception
113 119
	 */
114 120
	@Override
115 121
	public long delete(final String query) throws IndexClientException {
......
120 126
			String tquery = translatedQuery.getQuery();
121 127
			translatedQuery.setQueryLimit(0);
122 128

  
123
			SolrIndexQueryResponse rsp = new SolrIndexQueryResponse(client.query(translatedQuery));
129
			SolrIndexQueryResponse rsp = new SolrIndexQueryResponse(getClient().query(translatedQuery));
124 130
			QueryResponseParser responseParser = queryResponseFactory.getQueryResponseParser(rsp, mdRef);
125 131
			long total = responseParser.getNumFound();
126
			client.deleteByQuery(tquery);
127
			client.commit();
132
			getClient().deleteByQuery(tquery);
133
			getClient().commit();
128 134
			return total;
129 135
		} catch (Exception e) {
130 136
			throw new IndexClientException("unable to run delete by query: " + query, e);
......
135 141
	 * {@inheritDoc}
136 142
	 *
137 143
	 * @throws IndexClientException
144
	 *
145
	 * @see IndexClient#browse(String, List, int)
138 146
	 */
139 147
	@Override
140 148
	public List<BrowseEntry> browse(final String query, final List<String> browseFields, final int max) throws IndexClientException {
......
147 155
	 * {@inheritDoc}
148 156
	 *
149 157
	 * @throws IndexClientException
158
	 *
159
	 * @see IndexClient#browse(String, List, int, List)
150 160
	 */
151 161
	@Override
152 162
	public List<BrowseEntry> browse(final String query, final List<String> browseFields, final int max, final List<String> filterQuery)
......
164 174

  
165 175
	}
166 176

  
167
	public SolrIndexQuery buildBrowseQuery(final String query, final List<String> browseFields, final int max, final MetadataReference mdRef)
177
	private SolrIndexQuery buildBrowseQuery(final String query, final List<String> browseFields, final int max, final MetadataReference mdRef)
168 178
			throws IndexClientException {
169 179
		log.debug("Browse request for the index collection for query:" + query);
170 180

  
......
189 199
			final MetadataReference mdRef,
190 200
			final List<String> browseFields) throws IndexClientException {
191 201
		try {
192
			SolrIndexQueryResponse response = new SolrIndexQueryResponse(client.query(query));
202
			SolrIndexQueryResponse response = new SolrIndexQueryResponse(getClient().query(query));
193 203
			QueryResponseParser responseParser = queryResponseFactory.getQueryResponseParser(response, mdRef);
194 204
			List<BrowsingRow> results = responseParser.getBrowsingResults();
195 205
			List<BrowseEntry> out = convertBrowseEntry(browseFields, results, responseParser.getAliases());
196 206
			return out;
197
		} catch (Throwable e) {
207
		} catch (SolrServerException | IOException e) {
198 208
			throw new IndexClientException("Error on executing a query " + originalQuery, e);
199 209
		}
200 210
	}
......
203 213
	 * Creates the connection.
204 214
	 *
205 215
	 * @return the string
206
	 * @throws IndexClientException the index client exception
216
	 * @throws IndexClientException
217
	 *             the index client exception
207 218
	 */
208 219
	private String getUrl() throws IndexClientException {
209 220
		String address = serviceProperties.get(ZK_ADDRESS);
210
		if (address == null) { throw new IndexClientException("Unable to load a solr client, missing zk address"); }
221
		if (StringUtils.isBlank(address)) {
222
			throw new IndexClientException("Unable to load a solr client, missing zk address");
223
		}
211 224
		return address;
212 225
	}
213 226

  
214 227
	/**
215
	 * Gets the server.
228
	 * Gets the client.
216 229
	 *
217
	 * @return the server
218
	 * @throws IndexClientException the index client exception
230
	 * @return the client
231
	 * @throws IndexClientException
232
	 *             the index client exception
219 233
	 */
220
	public CloudSolrClient getClient() throws IndexClientException {
234
	public SolrClient getClient() throws IndexClientException {
221 235
		if (this.client == null) {
222 236
			String url = getUrl();
223 237
			log.debug("create new Client " + url);
224
			client = new CloudSolrClient(url);
238

  
239
			final ZkServers zk = ZkServers.newInstance(url);
240
			client = new CloudSolrClient.Builder(zk.getHosts(), zk.getChroot()).build();
241

  
242
			client.connect();
225 243
			client.setDefaultCollection(String.format("%s-%s-%s", getFormat(), getLayout(), getInterpretation()));
226 244
			try {
227 245
				client.ping();
......
233 251
	}
234 252

  
235 253
	/**
236
	 * Sets the server.
254
	 * Sets the client.
237 255
	 *
238
	 * @param client the Client
256
	 * @param client
257
	 *            the client
239 258
	 */
240 259
	public void setClient(final CloudSolrClient client) {
241 260
		this.client = client;
......
255 274
		}
256 275

  
257 276
		try {
258
			SolrIndexQueryResponse response = new SolrIndexQueryResponse(client.query(translatedQuery));
277
			SolrIndexQueryResponse response = new SolrIndexQueryResponse(getClient().query(translatedQuery));
259 278
			QueryResponseParser responseParser = queryResponseFactory.getQueryResponseParser(response, mdRef);
260 279

  
261 280
			return new LookupResponse(responseParser);
262
		} catch (Throwable e) {
281
		} catch (SolrServerException | IOException e) {
263 282
			throw new IndexClientException("Error on executing a query " + query, e);
264 283
		}
265 284

  
......
268 287
	@Override
269 288
	public CqlValueTransformerMap getCqlValueTransformerMap(final MetadataReference mdRef) throws IndexClientException {
270 289
		try {
271
			return this.tMapFactory.getIt(readFieldNamesAndTypes(mdRef.toString()));
290
			return tMapFactory.getIt(readFieldNamesAndTypes());
272 291
		} catch (Exception e) {
273 292
			throw new IndexClientException(e);
274

  
275 293
		}
276 294
	}
277 295

  
......
281 299
	}
282 300

  
283 301
	@Override
284
	public void stop() throws IndexClientException {
302
	public void close() throws IOException {
303
		log.debug("shutdown client: " + serviceProperties.get(ZK_ADDRESS));
304
		client.close();
305
	}
306

  
307
	public int feed(final String record, final String indexDsId, final Function<String, String> toIndexRecord) throws IndexClientException {
308
		return feed(record, indexDsId, toIndexRecord, true);
309
	}
310

  
311
	public int feed(final String record, final String indexDsId, final Function<String, String> toIndexRecord, final boolean commit)
312
			throws IndexClientException {
285 313
		try {
286
			log.debug("shutdown client: " + serviceProperties.get(ZK_ADDRESS));
287
			client.close();
288
		} catch (Throwable e) {
314
			final SolrInputDocument doc = prepareSolrDocument(record, indexDsId, toIndexRecord);
315
			if ((doc == null) || doc.isEmpty()) throw new IndexClientException("Invalid solr document");
316
			return feed(doc, commit);
317
		} catch (final Throwable e) {
318
			throw new IndexClientException("Error feeding document", e);
319
		}
320
	}
321

  
322
	public int feed(final SolrInputDocument document) throws IndexClientException {
323
		return feed(document, true);
324
	}
325

  
326
	public int feed(final List<SolrInputDocument> document) throws IndexClientException {
327
		try {
328
			final UpdateResponse res = getClient().add(document);
329
			log.debug("feed time for single records, elapsed time: " + HumanTime.exactly(res.getElapsedTime()));
330
			if (res.getStatus() != 0) { throw new IndexClientException("bad status: " + res.getStatus()); }
331
			return res.getStatus();
332
		} catch (final Throwable e) {
333
			throw new IndexClientException("Error feeding document", e);
334
		}
335
	}
336

  
337
	public int feed(final SolrInputDocument document, final boolean commit) throws IndexClientException {
338
		try {
339
			final UpdateResponse res = getClient().add(document);
340
			log.debug("feed time for single records, elapsed time: " + HumanTime.exactly(res.getElapsedTime()));
341
			if (res.getStatus() != 0) { throw new IndexClientException("bad status: " + res.getStatus()); }
342
			if (commit) {
343
				getClient().commit();
344
			}
345
			return res.getStatus();
346
		} catch (final Throwable e) {
347
			throw new IndexClientException("Error feeding document", e);
348
		}
349
	}
350

  
351
	public void feed(final List<SolrInputDocument> docs, final AfterFeedingCallback callback) throws IndexClientException {
352
		feed(docs, callback, true);
353
	}
354

  
355
	public void feed(final List<SolrInputDocument> docs, final AfterFeedingCallback callback, final boolean commit) throws IndexClientException {
356
		try {
357
			if (docs.isEmpty()) {
358
				log.debug("Empty list of documents. Calling callback, if needed.");
359
				if (callback != null) {
360
					callback.doAfterFeeding(null);
361
				}
362
				return;
363
			}
364
			final UpdateResponse res = getClient().add(docs);
365

  
366
			log.debug("feed time for " + docs.size() + " records, elapsed tipe: : " + HumanTime.exactly(res.getElapsedTime()));
367

  
368
			if (commit) {
369
				getClient().commit();
370
			}
371
			if (callback != null) {
372
				callback.doAfterFeeding(res);
373
			}
374
			if (res.getStatus() != 0) throw new IndexClientException("bad status: " + res.getStatus());
375
		} catch (final Throwable e) {
376
			throw new IndexClientException("Error feeding documents", e);
377
		}
378
	}
379

  
380
	public SolrInputDocument prepareSolrDocument(final String record, final String indexDsId, final Function<String, String> toIndexRecord)
381
			throws IndexClientException {
382
		try {
383
			final StreamingInputDocumentFactory documentFactory = new StreamingInputDocumentFactory();
384

  
385
			final String version = (new SimpleDateFormat("yyyy-MM-dd\'T\'hh:mm:ss\'Z\'")).format(new Date());
386
			final String indexRecord = toIndexRecord.apply(record);
387

  
388
			if (log.isDebugEnabled()) {
389
				log.debug("***************************************\nSubmitting index record:\n" + indexRecord + "\n***************************************\n");
390
			}
391

  
392
			return documentFactory.parseDocument(version, indexRecord, indexDsId, INDEX_RECORD_RESULT_FIELD);
393
		} catch (final Throwable e) {
394
			throw new IndexClientException("Error creating solr document", e);
395
		}
396
	}
397

  
398
	public boolean isRecordIndexed(final String id) throws IndexClientException {
399
		final QueryResponse res = query("objidentifier:\"" + id + "\"", null);
400
		return res.getResults().size() > 0;
401
	}
402

  
403
	public int remove(final String id) throws IndexClientException {
404
		return remove(id, true);
405
	}
406

  
407
	public UpdateResponse commit() throws IndexClientException {
408
		try {
409
			return getClient().commit();
410
		} catch (SolrServerException | IOException e) {
289 411
			throw new IndexClientException(e);
290 412
		}
291 413
	}
292 414

  
415
	public int remove(final String id, final boolean commit) throws IndexClientException {
416
		try {
417
			final UpdateResponse res = getClient().deleteByQuery("objidentifier:\"" + id + "\"");
418
			if (commit) {
419
				getClient().commit();
420
			}
421
			return res.getResponse().size();
422
		} catch (final Throwable e) {
423
			throw new IndexClientException("Error removing documents", e);
424
		}
425
	}
426

  
427
	public int count(final String query) throws IndexClientException {
428
		final QueryResponse res = query(query, 0);
429
		return res.getResults().size();
430
	}
431

  
432
	public QueryResponse query(final String query, Integer rows) throws IndexClientException {
433
		try {
434
			final SolrQuery solrQuery = new SolrQuery();
435
			solrQuery.setQuery(query);
436
			if(rows != null && rows >= 0) {
437
				solrQuery.setRows(rows);
438
			}
439
			return getClient().query(solrQuery);
440
		} catch (final Throwable e) {
441
			throw new IndexClientException("Error searching documents", e);
442
		}
443
	}
444

  
445
	public UpdateResponse deleteByQuery(final String query) throws IndexClientException {
446
		try {
447
			return getClient().deleteByQuery(query);
448
		} catch (final Throwable e) {
449
			throw new IndexClientException("Error searching documents", e);
450
		}
451
	}
452

  
453
	public interface AfterFeedingCallback {
454

  
455
		void doAfterFeeding(final UpdateResponse response);
456
	}
457

  
458
	/**
459
	 * Gets the format.
460
	 *
461
	 * @return the format
462
	 */
463
	public String getFormat() {
464
		return format;
465
	}
466

  
467
	/**
468
	 * Sets the format.
469
	 *
470
	 * @param format
471
	 *            the format
472
	 */
473
	public void setFormat(final String format) {
474
		this.format = format;
475
	}
476

  
477
	/**
478
	 * Gets the layout.
479
	 *
480
	 * @return the layout
481
	 */
482
	public String getLayout() {
483
		return layout;
484
	}
485

  
486
	/**
487
	 * Sets the layout.
488
	 *
489
	 * @param layout
490
	 *            the layout
491
	 */
492
	public void setLayout(final String layout) {
493
		this.layout = layout;
494
	}
495

  
496
	/**
497
	 * Gets the interpretation.
498
	 *
499
	 * @return the interpretation
500
	 */
501
	public String getInterpretation() {
502
		return interpretation;
503
	}
504

  
505
	/**
506
	 * Sets the interpretation.
507
	 *
508
	 * @param interpretation
509
	 *            the interpretation
510
	 */
511
	public void setInterpretation(final String interpretation) {
512
		this.interpretation = interpretation;
513
	}
514

  
515
	public Map<String, String> getServiceProperties() {
516
		return serviceProperties;
517
	}
518

  
519
	public void setServiceProperties(final Map<String, String> serviceProperties) {
520
		this.serviceProperties = serviceProperties;
521
	}
522

  
523
	// HELPERS
524

  
293 525
	private List<BrowseEntry> convertBrowseEntry(final List<String> browseFields, final List<BrowsingRow> results, final BiMap<String, String> aliases) {
294 526

  
295
		Map<String, BrowseEntry> mapResult = new HashMap<>();
527
		Map<String, BrowseEntry> mapResult = new HashMap<String, BrowseEntry>();
296 528
		for (BrowsingRow row : results) {
297 529
			for (GroupResult groupResult : row.getGroupResult()) {
298 530
				String name = groupResult.getName();
......
302 534
					entry = mapResult.get(name);
303 535
					valuesEntry = entry.getValues();
304 536
					if (valuesEntry == null) {
305
						valuesEntry = new ArrayList<>();
537
						valuesEntry = new ArrayList<BrowseValueEntry>();
306 538
						entry.setValues(valuesEntry);
307 539
					}
308 540

  
......
310 542
					entry = new BrowseEntry();
311 543
					entry.setField(name);
312 544
					entry.setLabel(name);
313
					valuesEntry = new ArrayList<>();
545
					valuesEntry = new ArrayList<BrowseValueEntry>();
314 546
					entry.setValues(valuesEntry);
315 547
					mapResult.put(name, entry);
316 548
				}
......
320 552
				valuesEntry.add(entryValue);
321 553
			}
322 554
		}
323
		List<BrowseEntry> out = new ArrayList<>();
555
		List<BrowseEntry> out = new ArrayList<BrowseEntry>();
324 556
		for (String b : browseFields) {
325 557
			String inverse = null;
326 558
			if (aliases != null) {
......
337 569
		return out;
338 570
	}
339 571

  
340
	private Map<String, ValueType> readFieldNamesAndTypes(final String coreName) throws SolrServerException, IOException, IndexClientException {
341
		// final SolrServer server = cloudServer.getSolrServer(coreName);
572
	private Map<String, ValueType> readFieldNamesAndTypes() throws SolrServerException, IOException, IndexClientException {
573

  
342 574
		final LukeRequest request = new LukeRequest();
343 575
		request.setShowSchema(true);
344 576

  
345
		// cloudServer.setDefaultCollection(coreName);
346 577
		request.setNumTerms(0);
347 578
		final LukeResponse response = request.process(getClient());
348 579
		final Map<String, FieldInfo> fieldInfos = response.getFieldInfo();
349 580
		final Map<String, LukeResponse.FieldTypeInfo> fieldTypeInfos = response.getFieldTypeInfo();
350
		return getStringValueTypeMap(fieldInfos, fieldTypeInfos);
581
		final Map<String, ValueType> result = Maps.newHashMap();
582
		for (FieldInfo fieldInfo : fieldInfos.values()) {
583
			LukeResponse.FieldTypeInfo fieldTypeInfo = fieldTypeInfos.get(fieldInfo.getType());
584
			final String fieldName = fieldTypeInfo.getName().toLowerCase();
585
			final ValueType fieldType = resolveSolrTypeClassName(fieldName);
586
			result.put(fieldInfo.getName(), fieldType);
587
		}
588
		return result;
351 589
	}
352 590

  
591
	private ValueType resolveSolrTypeClassName(final String solrTypeName) {
592
		if (solrTypeName.contains("LongField")) {
593
			return ValueType.LONG;
594
		} else if (solrTypeName.contains("IntField")) {
595
			return ValueType.LONG;
596
		} else if (solrTypeName.contains("short")) {
597
			return ValueType.LONG;
598
		} else if (solrTypeName.contains("float")) {
599
			return ValueType.DOUBLE;
600
		} else if (solrTypeName.contains("double")) {
601
			return ValueType.DOUBLE;
602
		} else if (solrTypeName.contains("date")) {
603
			return ValueType.DATETIME;
604
		} else {
605
			return ValueType.STRING;
606
		}
607
	}
353 608
}

Also available in: Unified diff