MtasSolrComponentFacet.java.html
47.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>MtasSolrComponentFacet.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">MTAS</a> > <a href="index.source.html" class="el_package">mtas.solr.handler.component.util</a> > <span class="el_source">MtasSolrComponentFacet.java</span></div><h1>MtasSolrComponentFacet.java</h1><pre class="source lang-java linenums">package mtas.solr.handler.component.util;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.lucene.document.FieldType.LegacyNumericType;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.handler.component.ResponseBuilder;
import org.apache.solr.handler.component.SearchComponent;
import org.apache.solr.handler.component.ShardRequest;
import org.apache.solr.handler.component.ShardResponse;
import org.apache.solr.schema.FieldType;
import org.apache.solr.schema.IndexSchema;
import org.apache.solr.schema.SchemaField;
import mtas.codec.util.CodecComponent.ComponentFacet;
import mtas.codec.util.CodecComponent.ComponentField;
import mtas.codec.util.CodecComponent.ComponentFields;
import mtas.codec.util.CodecComponent.SubComponentFunction;
import mtas.codec.util.collector.MtasDataCollector;
import mtas.parser.function.ParseException;
import mtas.search.spans.util.MtasSpanQuery;
import mtas.solr.handler.component.MtasSolrSearchComponent;
/**
* The Class MtasSolrComponentFacet.
*/
@SuppressWarnings("deprecation")
public class MtasSolrComponentFacet
implements MtasSolrComponent<ComponentFacet> {
/** The Constant log. */
<span class="fc" id="L39"> private static final Log log = LogFactory.getLog(MtasSolrComponentFacet.class);</span>
/** The search component. */
MtasSolrSearchComponent searchComponent;
/** The Constant PARAM_MTAS_FACET. */
public static final String PARAM_MTAS_FACET = MtasSolrSearchComponent.PARAM_MTAS
+ ".facet";
/** The Constant NAME_MTAS_FACET_KEY. */
public static final String NAME_MTAS_FACET_KEY = "key";
/** The Constant NAME_MTAS_FACET_FIELD. */
public static final String NAME_MTAS_FACET_FIELD = "field";
/** The Constant NAME_MTAS_FACET_QUERY. */
private static final String NAME_MTAS_FACET_QUERY = "query";
/** The Constant NAME_MTAS_FACET_BASE. */
private static final String NAME_MTAS_FACET_BASE = "base";
/** The Constant SUBNAME_MTAS_FACET_QUERY_TYPE. */
public static final String SUBNAME_MTAS_FACET_QUERY_TYPE = "type";
/** The Constant SUBNAME_MTAS_FACET_QUERY_VALUE. */
public static final String SUBNAME_MTAS_FACET_QUERY_VALUE = "value";
/** The Constant SUBNAME_MTAS_FACET_QUERY_PREFIX. */
public static final String SUBNAME_MTAS_FACET_QUERY_PREFIX = "prefix";
/** The Constant SUBNAME_MTAS_FACET_QUERY_IGNORE. */
public static final String SUBNAME_MTAS_FACET_QUERY_IGNORE = "ignore";
/** The Constant SUBNAME_MTAS_FACET_QUERY_MAXIMUM_IGNORE_LENGTH. */
public static final String SUBNAME_MTAS_FACET_QUERY_MAXIMUM_IGNORE_LENGTH = "maximumIgnoreLength";
/** The Constant SUBNAME_MTAS_FACET_QUERY_VARIABLE. */
public static final String SUBNAME_MTAS_FACET_QUERY_VARIABLE = "variable";
/** The Constant SUBNAME_MTAS_FACET_QUERY_VARIABLE_NAME. */
public static final String SUBNAME_MTAS_FACET_QUERY_VARIABLE_NAME = "name";
/** The Constant SUBNAME_MTAS_FACET_QUERY_VARIABLE_VALUE. */
public static final String SUBNAME_MTAS_FACET_QUERY_VARIABLE_VALUE = "value";
/** The Constant SUBNAME_MTAS_FACET_BASE_FIELD. */
public static final String SUBNAME_MTAS_FACET_BASE_FIELD = "field";
/** The Constant SUBNAME_MTAS_FACET_BASE_TYPE. */
public static final String SUBNAME_MTAS_FACET_BASE_TYPE = "type";
/** The Constant SUBNAME_MTAS_FACET_BASE_SORT_TYPE. */
public static final String SUBNAME_MTAS_FACET_BASE_SORT_TYPE = "sort.type";
/** The Constant SUBNAME_MTAS_FACET_BASE_SORT_DIRECTION. */
public static final String SUBNAME_MTAS_FACET_BASE_SORT_DIRECTION = "sort.direction";
/** The Constant SUBNAME_MTAS_FACET_BASE_NUMBER. */
public static final String SUBNAME_MTAS_FACET_BASE_NUMBER = "number";
/** The Constant SUBNAME_MTAS_FACET_BASE_MINIMUM. */
public static final String SUBNAME_MTAS_FACET_BASE_MINIMUM = "minimum";
/** The Constant SUBNAME_MTAS_FACET_BASE_MAXIMUM. */
public static final String SUBNAME_MTAS_FACET_BASE_MAXIMUM = "maximum";
/** The Constant SUBNAME_MTAS_FACET_BASE_FUNCTION. */
public static final String SUBNAME_MTAS_FACET_BASE_FUNCTION = "function";
/** The Constant SUBNAME_MTAS_FACET_BASE_FUNCTION_KEY. */
public static final String SUBNAME_MTAS_FACET_BASE_FUNCTION_KEY = "key";
/** The Constant SUBNAME_MTAS_FACET_BASE_FUNCTION_EXPRESSION. */
public static final String SUBNAME_MTAS_FACET_BASE_FUNCTION_EXPRESSION = "expression";
/** The Constant SUBNAME_MTAS_FACET_BASE_FUNCTION_TYPE. */
public static final String SUBNAME_MTAS_FACET_BASE_FUNCTION_TYPE = "type";
/** The Constant SUBNAME_MTAS_FACET_BASE_RANGE. */
public static final String SUBNAME_MTAS_FACET_BASE_RANGE = "range";
/** The Constant SUBNAME_MTAS_FACET_BASE_RANGE_SIZE. */
public static final String SUBNAME_MTAS_FACET_BASE_RANGE_SIZE = "size";
/** The Constant SUBNAME_MTAS_FACET_BASE_RANGE_BASE. */
public static final String SUBNAME_MTAS_FACET_BASE_RANGE_BASE = "base";
/**
* Instantiates a new mtas solr component facet.
*
* @param searchComponent the search component
*/
<span class="fc" id="L131"> public MtasSolrComponentFacet(MtasSolrSearchComponent searchComponent) {</span>
<span class="fc" id="L132"> this.searchComponent = searchComponent;</span>
<span class="fc" id="L133"> }</span>
/*
* (non-Javadoc)
*
* @see
* mtas.solr.handler.component.util.MtasSolrComponent#prepare(org.apache.solr.
* handler.component.ResponseBuilder,
* mtas.codec.util.CodecComponent.ComponentFields)
*/
public void prepare(ResponseBuilder rb, ComponentFields mtasFields)
throws IOException {
<span class="nc" id="L145"> Set<String> ids = MtasSolrResultUtil</span>
<span class="nc" id="L146"> .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_FACET);</span>
<span class="nc bnc" id="L147" title="All 2 branches missed."> if (!ids.isEmpty()) {</span>
<span class="nc" id="L148"> int tmpCounter = 0;</span>
String tmpValue;
<span class="nc" id="L150"> String[] fields = new String[ids.size()];</span>
<span class="nc" id="L151"> String[] keys = new String[ids.size()];</span>
<span class="nc" id="L152"> String[][] queryTypes = new String[ids.size()][];</span>
<span class="nc" id="L153"> String[][] queryValues = new String[ids.size()][];</span>
<span class="nc" id="L154"> String[][] queryPrefixes = new String[ids.size()][];</span>
<span class="nc" id="L155"> String[][] queryIgnores = new String[ids.size()][];</span>
<span class="nc" id="L156"> String[][] queryMaximumIgnoreLengths = new String[ids.size()][];</span>
<span class="nc" id="L157"> HashMap<String, String[]>[][] queryVariables = new HashMap[ids.size()][];</span>
<span class="nc" id="L158"> String[][] baseFields = new String[ids.size()][];</span>
<span class="nc" id="L159"> String[][] baseFieldTypes = new String[ids.size()][];</span>
<span class="nc" id="L160"> String[][] baseTypes = new String[ids.size()][];</span>
<span class="nc" id="L161"> Double[][] baseRangeSizes = new Double[ids.size()][];</span>
<span class="nc" id="L162"> Double[][] baseRangeBases = new Double[ids.size()][];</span>
<span class="nc" id="L163"> String[][] baseSortTypes = new String[ids.size()][];</span>
<span class="nc" id="L164"> String[][] baseSortDirections = new String[ids.size()][];</span>
<span class="nc" id="L165"> Integer[][] baseNumbers = new Integer[ids.size()][];</span>
<span class="nc" id="L166"> Double[][] baseMinima = new Double[ids.size()][];</span>
<span class="nc" id="L167"> Double[][] baseMaxima = new Double[ids.size()][];</span>
<span class="nc" id="L168"> String[][][] baseFunctionExpressions = new String[ids.size()][][];</span>
<span class="nc" id="L169"> String[][][] baseFunctionKeys = new String[ids.size()][][];</span>
<span class="nc" id="L170"> String[][][] baseFunctionTypes = new String[ids.size()][][];</span>
<span class="nc bnc" id="L171" title="All 2 branches missed."> for (String id : ids) {</span>
<span class="nc" id="L172"> fields[tmpCounter] = rb.req.getParams().get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_FIELD, null);
<span class="nc" id="L174"> keys[tmpCounter] = rb.req.getParams()</span>
<span class="nc" id="L175"> .get(PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_KEY,</span>
<span class="nc" id="L176"> String.valueOf(tmpCounter))</span>
<span class="nc" id="L177"> .trim();</span>
<span class="nc" id="L178"> Set<String> qIds = MtasSolrResultUtil.getIdsFromParameters(</span>
<span class="nc" id="L179"> rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_QUERY);
<span class="nc bnc" id="L181" title="All 2 branches missed."> if (!qIds.isEmpty()) {</span>
<span class="nc" id="L182"> int tmpQCounter = 0;</span>
<span class="nc" id="L183"> queryTypes[tmpCounter] = new String[qIds.size()];</span>
<span class="nc" id="L184"> queryValues[tmpCounter] = new String[qIds.size()];</span>
<span class="nc" id="L185"> queryPrefixes[tmpCounter] = new String[qIds.size()];</span>
<span class="nc" id="L186"> queryIgnores[tmpCounter] = new String[qIds.size()];</span>
<span class="nc" id="L187"> queryMaximumIgnoreLengths[tmpCounter] = new String[qIds.size()];</span>
<span class="nc" id="L188"> queryVariables[tmpCounter] = new HashMap[qIds.size()];</span>
<span class="nc bnc" id="L189" title="All 2 branches missed."> for (String qId : qIds) {</span>
<span class="nc" id="L190"> queryTypes[tmpCounter][tmpQCounter] = rb.req.getParams()</span>
<span class="nc" id="L191"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_QUERY
+ "." + qId + "." + SUBNAME_MTAS_FACET_QUERY_TYPE,
null);
<span class="nc" id="L195"> queryValues[tmpCounter][tmpQCounter] = rb.req.getParams()</span>
<span class="nc" id="L196"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_QUERY
+ "." + qId + "." + SUBNAME_MTAS_FACET_QUERY_VALUE,
null);
<span class="nc" id="L200"> queryPrefixes[tmpCounter][tmpQCounter] = rb.req.getParams()</span>
<span class="nc" id="L201"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_QUERY
+ "." + qId + "." + SUBNAME_MTAS_FACET_QUERY_PREFIX,
null);
<span class="nc" id="L205"> queryIgnores[tmpCounter][tmpQCounter] = rb.req.getParams()</span>
<span class="nc" id="L206"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_QUERY
+ "." + qId + "." + SUBNAME_MTAS_FACET_QUERY_IGNORE,
null);
<span class="nc" id="L210"> queryMaximumIgnoreLengths[tmpCounter][tmpQCounter] = rb.req</span>
<span class="nc" id="L211"> .getParams()</span>
<span class="nc" id="L212"> .get(PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_QUERY</span>
+ "." + qId + "."
+ SUBNAME_MTAS_FACET_QUERY_MAXIMUM_IGNORE_LENGTH, null);
<span class="nc" id="L215"> Set<String> vIds = MtasSolrResultUtil.getIdsFromParameters(</span>
<span class="nc" id="L216"> rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_QUERY + "."
+ qId + "." + SUBNAME_MTAS_FACET_QUERY_VARIABLE);
<span class="nc" id="L219"> queryVariables[tmpCounter][tmpQCounter] = new HashMap<>();</span>
<span class="nc bnc" id="L220" title="All 2 branches missed."> if (!vIds.isEmpty()) {</span>
<span class="nc" id="L221"> HashMap<String, ArrayList<String>> tmpVariables = new HashMap<>();</span>
<span class="nc bnc" id="L222" title="All 2 branches missed."> for (String vId : vIds) {</span>
<span class="nc" id="L223"> String name = rb.req.getParams().get(PARAM_MTAS_FACET + "." + id</span>
+ "." + NAME_MTAS_FACET_QUERY + "." + qId + "."
+ SUBNAME_MTAS_FACET_QUERY_VARIABLE + "." + vId + "."
+ SUBNAME_MTAS_FACET_QUERY_VARIABLE_NAME, null);
<span class="nc bnc" id="L227" title="All 2 branches missed."> if (name != null) {</span>
<span class="nc bnc" id="L228" title="All 2 branches missed."> if (!tmpVariables.containsKey(name)) {</span>
<span class="nc" id="L229"> tmpVariables.put(name, new ArrayList<String>());</span>
}
<span class="nc" id="L231"> String value = rb.req.getParams().get(PARAM_MTAS_FACET + "."</span>
+ id + "." + NAME_MTAS_FACET_QUERY + "." + qId + "."
+ SUBNAME_MTAS_FACET_QUERY_VARIABLE + "." + vId + "."
+ SUBNAME_MTAS_FACET_QUERY_VARIABLE_VALUE, null);
<span class="nc bnc" id="L235" title="All 2 branches missed."> if (value != null) {</span>
<span class="nc" id="L236"> ArrayList<String> list = new ArrayList<>();</span>
<span class="nc" id="L237"> String[] subList = value.split("(?<!\\\\),");</span>
<span class="nc bnc" id="L238" title="All 2 branches missed."> for (int i = 0; i < subList.length; i++) {</span>
<span class="nc" id="L239"> list.add(</span>
<span class="nc" id="L240"> subList[i].replace("\\,", ",").replace("\\\\", "\\"));</span>
}
<span class="nc" id="L242"> tmpVariables.get(name).addAll(list);</span>
}
}
<span class="nc" id="L245"> }</span>
<span class="nc bnc" id="L246" title="All 2 branches missed."> for (Entry<String, ArrayList<String>> entry : tmpVariables</span>
<span class="nc" id="L247"> .entrySet()) {</span>
<span class="nc" id="L248"> queryVariables[tmpCounter][tmpQCounter].put(entry.getKey(),</span>
<span class="nc" id="L249"> entry.getValue()</span>
<span class="nc" id="L250"> .toArray(new String[entry.getValue().size()]));</span>
<span class="nc" id="L251"> }</span>
}
<span class="nc" id="L253"> tmpQCounter++;</span>
<span class="nc" id="L254"> }</span>
<span class="nc" id="L255"> } else {</span>
<span class="nc" id="L256"> throw new IOException(</span>
"no " + NAME_MTAS_FACET_QUERY + " for mtas facet " + id);
}
<span class="nc" id="L259"> Set<String> bIds = MtasSolrResultUtil.getIdsFromParameters(</span>
<span class="nc" id="L260"> rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE);
<span class="nc bnc" id="L262" title="All 2 branches missed."> if (!bIds.isEmpty()) {</span>
<span class="nc" id="L263"> int tmpBCounter = 0;</span>
<span class="nc" id="L264"> baseFields[tmpCounter] = new String[bIds.size()];</span>
<span class="nc" id="L265"> baseFieldTypes[tmpCounter] = new String[bIds.size()];</span>
<span class="nc" id="L266"> baseTypes[tmpCounter] = new String[bIds.size()];</span>
<span class="nc" id="L267"> baseRangeSizes[tmpCounter] = new Double[bIds.size()];</span>
<span class="nc" id="L268"> baseRangeBases[tmpCounter] = new Double[bIds.size()];</span>
<span class="nc" id="L269"> baseSortTypes[tmpCounter] = new String[bIds.size()];</span>
<span class="nc" id="L270"> baseSortDirections[tmpCounter] = new String[bIds.size()];</span>
<span class="nc" id="L271"> baseNumbers[tmpCounter] = new Integer[bIds.size()];</span>
<span class="nc" id="L272"> baseMinima[tmpCounter] = new Double[bIds.size()];</span>
<span class="nc" id="L273"> baseMaxima[tmpCounter] = new Double[bIds.size()];</span>
<span class="nc" id="L274"> baseFunctionKeys[tmpCounter] = new String[bIds.size()][];</span>
<span class="nc" id="L275"> baseFunctionExpressions[tmpCounter] = new String[bIds.size()][];</span>
<span class="nc" id="L276"> baseFunctionTypes[tmpCounter] = new String[bIds.size()][];</span>
<span class="nc bnc" id="L277" title="All 2 branches missed."> for (String bId : bIds) {</span>
<span class="nc" id="L278"> baseFields[tmpCounter][tmpBCounter] = rb.req.getParams()</span>
<span class="nc" id="L279"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_FIELD,
null);
<span class="nc" id="L283"> baseFieldTypes[tmpCounter][tmpBCounter] = getFieldType(</span>
<span class="nc" id="L284"> rb.req.getSchema(), baseFields[tmpCounter][tmpBCounter]);</span>
<span class="nc" id="L285"> baseTypes[tmpCounter][tmpBCounter] = rb.req.getParams()</span>
<span class="nc" id="L286"> .get(PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE</span>
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_TYPE, null);
<span class="nc" id="L288"> tmpValue = rb.req.getParams()</span>
<span class="nc" id="L289"> .get(PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE</span>
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_RANGE + "."
+ SUBNAME_MTAS_FACET_BASE_RANGE_SIZE, null);
<span class="nc bnc" id="L292" title="All 2 branches missed."> baseRangeSizes[tmpCounter][tmpBCounter] = tmpValue == null ? null</span>
<span class="nc" id="L293"> : Double.parseDouble(tmpValue);</span>
<span class="nc" id="L294"> tmpValue = rb.req.getParams()</span>
<span class="nc" id="L295"> .get(PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE</span>
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_RANGE + "."
+ SUBNAME_MTAS_FACET_BASE_RANGE_BASE, null);
<span class="nc bnc" id="L298" title="All 2 branches missed."> baseRangeBases[tmpCounter][tmpBCounter] = tmpValue == null ? null</span>
<span class="nc" id="L299"> : Double.parseDouble(tmpValue);</span>
<span class="nc" id="L300"> baseSortTypes[tmpCounter][tmpBCounter] = rb.req.getParams()</span>
<span class="nc" id="L301"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_SORT_TYPE,
null);
<span class="nc" id="L305"> baseSortDirections[tmpCounter][tmpBCounter] = rb.req.getParams()</span>
<span class="nc" id="L306"> .get(PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE</span>
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_SORT_DIRECTION,
null);
<span class="nc" id="L309"> tmpValue = rb.req.getParams()</span>
<span class="nc" id="L310"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_NUMBER,
null);
<span class="nc bnc" id="L314" title="All 2 branches missed."> baseNumbers[tmpCounter][tmpBCounter] = tmpValue != null</span>
<span class="nc" id="L315"> ? getPositiveInteger(tmpValue) : null;</span>
<span class="nc" id="L316"> tmpValue = rb.req.getParams()</span>
<span class="nc" id="L317"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_MINIMUM,
null);
<span class="nc bnc" id="L321" title="All 2 branches missed."> baseMinima[tmpCounter][tmpBCounter] = tmpValue != null</span>
<span class="nc" id="L322"> ? getDouble(tmpValue) : null;</span>
<span class="nc" id="L323"> tmpValue = rb.req.getParams()</span>
<span class="nc" id="L324"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_MAXIMUM,
null);
<span class="nc bnc" id="L328" title="All 2 branches missed."> baseMaxima[tmpCounter][tmpBCounter] = tmpValue != null</span>
<span class="nc" id="L329"> ? getDouble(tmpValue) : null;</span>
<span class="nc" id="L330"> Set<String> functionIds = MtasSolrResultUtil.getIdsFromParameters(</span>
<span class="nc" id="L331"> rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE + "."
+ bId + "." + SUBNAME_MTAS_FACET_BASE_FUNCTION);
<span class="nc" id="L334"> baseFunctionExpressions[tmpCounter][tmpBCounter] = new String[functionIds</span>
<span class="nc" id="L335"> .size()];</span>
<span class="nc" id="L336"> baseFunctionKeys[tmpCounter][tmpBCounter] = new String[functionIds</span>
<span class="nc" id="L337"> .size()];</span>
<span class="nc" id="L338"> baseFunctionTypes[tmpCounter][tmpBCounter] = new String[functionIds</span>
<span class="nc" id="L339"> .size()];</span>
<span class="nc" id="L340"> int tmpSubCounter = 0;</span>
<span class="nc bnc" id="L341" title="All 2 branches missed."> for (String functionId : functionIds) {</span>
<span class="nc" id="L342"> baseFunctionKeys[tmpCounter][tmpBCounter][tmpSubCounter] = rb.req</span>
<span class="nc" id="L343"> .getParams()</span>
<span class="nc" id="L344"> .get(PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE</span>
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_FUNCTION + "."
+ functionId + "." + SUBNAME_MTAS_FACET_BASE_FUNCTION_KEY,
<span class="nc" id="L347"> String.valueOf(tmpSubCounter))</span>
<span class="nc" id="L348"> .trim();</span>
<span class="nc" id="L349"> baseFunctionExpressions[tmpCounter][tmpBCounter][tmpSubCounter] = rb.req</span>
<span class="nc" id="L350"> .getParams()</span>
<span class="nc" id="L351"> .get(PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE</span>
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_FUNCTION + "."
+ functionId + "."
+ SUBNAME_MTAS_FACET_BASE_FUNCTION_EXPRESSION, null);
<span class="nc" id="L355"> baseFunctionTypes[tmpCounter][tmpBCounter][tmpSubCounter] = rb.req</span>
<span class="nc" id="L356"> .getParams()</span>
<span class="nc" id="L357"> .get(PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE</span>
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_FUNCTION + "."
+ functionId + "."
+ SUBNAME_MTAS_FACET_BASE_FUNCTION_TYPE, null);
<span class="nc" id="L361"> tmpSubCounter++;</span>
<span class="nc" id="L362"> }</span>
<span class="nc" id="L363"> tmpBCounter++;</span>
<span class="nc" id="L364"> }</span>
<span class="nc" id="L365"> } else {</span>
<span class="nc" id="L366"> throw new IOException(</span>
"no " + NAME_MTAS_FACET_BASE + " for mtas facet " + id);
}
<span class="nc" id="L369"> tmpCounter++;</span>
<span class="nc" id="L370"> }</span>
<span class="nc" id="L371"> String uniqueKeyField = rb.req.getSchema().getUniqueKeyField().getName();</span>
<span class="nc" id="L372"> mtasFields.doFacet = true;</span>
<span class="nc" id="L373"> rb.setNeedDocSet(true);</span>
<span class="nc bnc" id="L374" title="All 2 branches missed."> for (String field : fields) {</span>
<span class="nc bnc" id="L375" title="All 4 branches missed."> if (field == null || field.isEmpty()) {</span>
<span class="nc" id="L376"> throw new IOException("no (valid) field in mtas facet");</span>
<span class="nc bnc" id="L377" title="All 2 branches missed."> } else if (!mtasFields.list.containsKey(field)) {</span>
<span class="nc" id="L378"> mtasFields.list.put(field, new ComponentField(uniqueKeyField));</span>
}
}
<span class="nc" id="L381"> MtasSolrResultUtil.compareAndCheck(keys, fields, NAME_MTAS_FACET_KEY,</span>
<span class="nc" id="L382"> NAME_MTAS_FACET_FIELD, true);</span>
<span class="nc bnc" id="L383" title="All 2 branches missed."> for (int i = 0; i < fields.length; i++) {</span>
<span class="nc" id="L384"> ComponentField cf = mtasFields.list.get(fields[i]);</span>
<span class="nc" id="L385"> int queryNumber = queryValues[i].length;</span>
<span class="nc" id="L386"> MtasSpanQuery[] ql = new MtasSpanQuery[queryNumber];</span>
<span class="nc bnc" id="L387" title="All 2 branches missed."> for (int j = 0; j < queryNumber; j++) {</span>
<span class="nc bnc" id="L388" title="All 2 branches missed."> Integer maximumIgnoreLength = (queryMaximumIgnoreLengths[i][j] == null)</span>
<span class="nc" id="L389"> ? null : Integer.parseInt(queryMaximumIgnoreLengths[i][j]);</span>
<span class="nc" id="L390"> MtasSpanQuery q = MtasSolrResultUtil.constructQuery(queryValues[i][j],</span>
queryTypes[i][j], queryPrefixes[i][j], queryVariables[i][j],
fields[i], queryIgnores[i][j], maximumIgnoreLength);
// minimize number of queries
<span class="nc bnc" id="L394" title="All 2 branches missed."> if (cf.spanQueryList.contains(q)) {</span>
<span class="nc" id="L395"> q = cf.spanQueryList.get(cf.spanQueryList.indexOf(q));</span>
} else {
<span class="nc" id="L397"> cf.spanQueryList.add(q);</span>
}
<span class="nc" id="L399"> ql[j] = q;</span>
}
<span class="nc bnc" id="L401" title="All 4 branches missed."> String key = (keys[i] == null) || (keys[i].isEmpty())</span>
<span class="nc" id="L402"> ? String.valueOf(i) + ":" + fields[i] : keys[i].trim();</span>
try {
<span class="nc" id="L404"> mtasFields.list.get(fields[i]).facetList.add(new ComponentFacet(ql,</span>
fields[i], key, baseFields[i], baseFieldTypes[i], baseTypes[i],
baseRangeSizes[i], baseRangeBases[i], baseSortTypes[i],
baseSortDirections[i], baseNumbers[i], baseMinima[i],
baseMaxima[i], baseFunctionKeys[i], baseFunctionExpressions[i],
baseFunctionTypes[i]));
<span class="nc" id="L410"> } catch (ParseException e) {</span>
<span class="nc" id="L411"> throw new IOException(e.getMessage());</span>
<span class="nc" id="L412"> }</span>
}
}
<span class="nc" id="L415"> }</span>
/*
* (non-Javadoc)
*
* @see
* mtas.solr.handler.component.util.MtasSolrComponent#modifyRequest(org.apache
* .solr.handler.component.ResponseBuilder,
* org.apache.solr.handler.component.SearchComponent,
* org.apache.solr.handler.component.ShardRequest)
*/
public void modifyRequest(ResponseBuilder rb, SearchComponent who,
ShardRequest sreq) {
<span class="nc bnc" id="L428" title="All 2 branches missed."> if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)</span>
<span class="nc bnc" id="L429" title="All 2 branches missed."> && sreq.params.getBool(PARAM_MTAS_FACET, false)) {</span>
<span class="nc bnc" id="L430" title="All 2 branches missed."> if ((sreq.purpose & ShardRequest.PURPOSE_GET_TOP_IDS) != 0) {</span>
// do nothing
} else {
// remove prefix for other requests
<span class="nc" id="L434"> Set<String> keys = MtasSolrResultUtil</span>
<span class="nc" id="L435"> .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_FACET);</span>
<span class="nc" id="L436"> sreq.params.remove(PARAM_MTAS_FACET);</span>
<span class="nc bnc" id="L437" title="All 2 branches missed."> for (String key : keys) {</span>
<span class="nc" id="L438"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_FIELD);
<span class="nc" id="L440"> sreq.params</span>
<span class="nc" id="L441"> .remove(PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_KEY);</span>
<span class="nc" id="L442"> Set<String> subKeys = MtasSolrResultUtil.getIdsFromParameters(</span>
<span class="nc" id="L443"> rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY);
<span class="nc bnc" id="L445" title="All 2 branches missed."> for (String subKey : subKeys) {</span>
<span class="nc" id="L446"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY + "."
+ subKey + "." + SUBNAME_MTAS_FACET_QUERY_TYPE);
<span class="nc" id="L449"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY + "."
+ subKey + "." + SUBNAME_MTAS_FACET_QUERY_VALUE);
<span class="nc" id="L452"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY + "."
+ subKey + "." + SUBNAME_MTAS_FACET_QUERY_PREFIX);
<span class="nc" id="L455"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY + "."
+ subKey + "." + SUBNAME_MTAS_FACET_QUERY_IGNORE);
<span class="nc" id="L458"> sreq.params.remove(PARAM_MTAS_FACET + "." + key + "."</span>
+ NAME_MTAS_FACET_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_FACET_QUERY_MAXIMUM_IGNORE_LENGTH);
<span class="nc" id="L461"> Set<String> subSubKeys = MtasSolrResultUtil</span>
<span class="nc" id="L462"> .getIdsFromParameters(rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY
+ "." + subKey + "."
+ SUBNAME_MTAS_FACET_QUERY_VARIABLE);
<span class="nc bnc" id="L466" title="All 2 branches missed."> for (String subSubKey : subSubKeys) {</span>
<span class="nc" id="L467"> sreq.params.remove(PARAM_MTAS_FACET + "." + key + "."</span>
+ NAME_MTAS_FACET_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_FACET_QUERY_VARIABLE + "." + subSubKey + "."
+ SUBNAME_MTAS_FACET_QUERY_VARIABLE_NAME);
<span class="nc" id="L471"> sreq.params.remove(PARAM_MTAS_FACET + "." + key + "."</span>
+ NAME_MTAS_FACET_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_FACET_QUERY_VARIABLE + "." + subSubKey + "."
+ SUBNAME_MTAS_FACET_QUERY_VARIABLE_VALUE);
<span class="nc" id="L475"> }</span>
<span class="nc" id="L476"> }</span>
<span class="nc" id="L477"> subKeys = MtasSolrResultUtil.getIdsFromParameters(rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE);
<span class="nc bnc" id="L479" title="All 2 branches missed."> for (String subKey : subKeys) {</span>
<span class="nc" id="L480"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_FIELD);
<span class="nc" id="L483"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_TYPE);
<span class="nc" id="L486"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_RANGE + "."
+ SUBNAME_MTAS_FACET_BASE_RANGE_SIZE);
<span class="nc" id="L490"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_RANGE + "."
+ SUBNAME_MTAS_FACET_BASE_RANGE_BASE);
<span class="nc" id="L494"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_MAXIMUM);
<span class="nc" id="L497"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_MINIMUM);
<span class="nc" id="L500"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_NUMBER);
<span class="nc" id="L503"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_SORT_DIRECTION);
<span class="nc" id="L506"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_SORT_TYPE);
<span class="nc" id="L509"> Set<String> subSubKeys = MtasSolrResultUtil</span>
<span class="nc" id="L510"> .getIdsFromParameters(rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE
+ "." + subKey + "."
+ SUBNAME_MTAS_FACET_BASE_FUNCTION);
<span class="nc bnc" id="L514" title="All 2 branches missed."> for (String subSubKey : subSubKeys) {</span>
<span class="nc" id="L515"> sreq.params.remove(PARAM_MTAS_FACET + "." + key + "."</span>
+ NAME_MTAS_FACET_BASE + "." + subKey + "."
+ SUBNAME_MTAS_FACET_BASE_FUNCTION + "." + subSubKey + "."
+ SUBNAME_MTAS_FACET_BASE_FUNCTION_EXPRESSION);
<span class="nc" id="L519"> sreq.params.remove(PARAM_MTAS_FACET + "." + key + "."</span>
+ NAME_MTAS_FACET_BASE + "." + subKey + "."
+ SUBNAME_MTAS_FACET_BASE_FUNCTION + "." + subSubKey + "."
+ SUBNAME_MTAS_FACET_BASE_FUNCTION_KEY);
<span class="nc" id="L523"> sreq.params.remove(PARAM_MTAS_FACET + "." + key + "."</span>
+ NAME_MTAS_FACET_BASE + "." + subKey + "."
+ SUBNAME_MTAS_FACET_BASE_FUNCTION + "." + subSubKey + "."
+ SUBNAME_MTAS_FACET_BASE_FUNCTION_TYPE);
<span class="nc" id="L527"> }</span>
<span class="nc" id="L528"> }</span>
<span class="nc" id="L529"> }</span>
}
}
<span class="nc" id="L532"> }</span>
/*
* (non-Javadoc)
*
* @see
* mtas.solr.handler.component.util.MtasSolrComponent#create(mtas.codec.util.
* CodecComponent.BasicComponent, java.lang.Boolean)
*/
public SimpleOrderedMap<Object> create(ComponentFacet facet, Boolean encode)
throws IOException {
<span class="nc" id="L543"> SimpleOrderedMap<Object> mtasFacetResponse = new SimpleOrderedMap<>();</span>
<span class="nc" id="L544"> mtasFacetResponse.add("key", facet.key);</span>
<span class="nc" id="L545"> HashMap<MtasDataCollector<?, ?>, HashMap<String, MtasSolrMtasResult>> functionData = new HashMap<>();</span>
<span class="nc bnc" id="L546" title="All 2 branches missed."> for (int i = 0; i < facet.baseFields.length; i++) {</span>
<span class="nc bnc" id="L547" title="All 2 branches missed."> if (facet.baseFunctionList[i] != null) {</span>
<span class="nc bnc" id="L548" title="All 2 branches missed."> for (MtasDataCollector<?, ?> functionDataCollector : facet.baseFunctionList[i]</span>
<span class="nc" id="L549"> .keySet()) {</span>
<span class="nc" id="L550"> SubComponentFunction[] tmpSubComponentFunctionList = facet.baseFunctionList[i]</span>
<span class="nc" id="L551"> .get(functionDataCollector);</span>
<span class="nc bnc" id="L552" title="All 2 branches missed."> if (tmpSubComponentFunctionList != null) {</span>
<span class="nc" id="L553"> HashMap<String, MtasSolrMtasResult> tmpList = new HashMap<>();</span>
<span class="nc bnc" id="L554" title="All 2 branches missed."> for (SubComponentFunction tmpSubComponentFunction : tmpSubComponentFunctionList) {</span>
<span class="nc" id="L555"> tmpList.put(tmpSubComponentFunction.key,</span>
new MtasSolrMtasResult(tmpSubComponentFunction.dataCollector,
tmpSubComponentFunction.dataType,
tmpSubComponentFunction.statsType,
tmpSubComponentFunction.statsItems, null));
}
<span class="nc" id="L561"> functionData.put(functionDataCollector, tmpList);</span>
}
<span class="nc" id="L563"> }</span>
}
}
<span class="nc" id="L566"> MtasSolrMtasResult data = new MtasSolrMtasResult(facet.dataCollector,</span>
facet.baseDataTypes, facet.baseStatsTypes, facet.baseStatsItems,
facet.baseSortTypes, facet.baseSortDirections, null, facet.baseNumbers,
functionData);
<span class="nc bnc" id="L571" title="All 2 branches missed."> if (encode) {</span>
<span class="nc" id="L572"> mtasFacetResponse.add("_encoded_list", MtasSolrResultUtil.encode(data));</span>
} else {
<span class="nc" id="L574"> mtasFacetResponse.add("list", data);</span>
<span class="nc" id="L575"> MtasSolrResultUtil.rewrite(mtasFacetResponse);</span>
}
<span class="nc" id="L577"> return mtasFacetResponse;</span>
}
/*
* (non-Javadoc)
*
* @see
* mtas.solr.handler.component.util.MtasSolrComponent#finishStage(org.apache.
* solr.handler.component.ResponseBuilder)
*/
@SuppressWarnings("unchecked")
public void finishStage(ResponseBuilder rb) {
<span class="nc bnc" id="L589" title="All 6 branches missed."> if (rb.req.getParams().getBool(MtasSolrSearchComponent.PARAM_MTAS, false)</span>
&& rb.stage >= ResponseBuilder.STAGE_EXECUTE_QUERY
&& rb.stage < ResponseBuilder.STAGE_GET_FIELDS) {
<span class="nc bnc" id="L592" title="All 2 branches missed."> for (ShardRequest sreq : rb.finished) {</span>
<span class="nc bnc" id="L593" title="All 2 branches missed."> if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)</span>
<span class="nc bnc" id="L594" title="All 2 branches missed."> && sreq.params.getBool(PARAM_MTAS_FACET, false)) {</span>
<span class="nc bnc" id="L595" title="All 2 branches missed."> for (ShardResponse shardResponse : sreq.responses) {</span>
<span class="nc" id="L596"> NamedList<Object> response = shardResponse.getSolrResponse()</span>
<span class="nc" id="L597"> .getResponse();</span>
try {
<span class="nc" id="L599"> ArrayList<NamedList<Object>> data = (ArrayList<NamedList<Object>>) response</span>
<span class="nc" id="L600"> .findRecursive("mtas", "facet");</span>
<span class="nc bnc" id="L601" title="All 2 branches missed."> if (data != null) {</span>
<span class="nc" id="L602"> MtasSolrResultUtil.decode(data);</span>
}
<span class="nc" id="L604"> } catch (ClassCastException e) {</span>
<span class="nc" id="L605"> log.debug(e);</span>
// shouldn't happen
<span class="nc" id="L607"> }</span>
<span class="nc" id="L608"> }</span>
}
<span class="nc" id="L610"> }</span>
}
<span class="nc" id="L612"> }</span>
/*
* (non-Javadoc)
*
* @see
* mtas.solr.handler.component.util.MtasSolrComponent#distributedProcess(org.
* apache.solr.handler.component.ResponseBuilder,
* mtas.codec.util.CodecComponent.ComponentFields)
*/
@SuppressWarnings("unchecked")
public void distributedProcess(ResponseBuilder rb, ComponentFields mtasFields)
throws IOException {
// rewrite
<span class="nc" id="L626"> NamedList<Object> mtasResponse = null;</span>
try {
<span class="nc" id="L628"> mtasResponse = (NamedList<Object>) rb.rsp.getValues().get("mtas");</span>
<span class="nc" id="L629"> } catch (ClassCastException e) {</span>
<span class="nc" id="L630"> log.debug(e);</span>
<span class="nc" id="L631"> mtasResponse = null;</span>
<span class="nc" id="L632"> }</span>
<span class="nc bnc" id="L633" title="All 2 branches missed."> if (mtasResponse != null) {</span>
ArrayList<Object> mtasResponseFacet;
try {
<span class="nc" id="L636"> mtasResponseFacet = (ArrayList<Object>) mtasResponse.get("facet");</span>
<span class="nc bnc" id="L637" title="All 2 branches missed."> if (mtasResponseFacet != null) {</span>
<span class="nc" id="L638"> MtasSolrResultUtil.rewrite(mtasResponseFacet);</span>
}
<span class="nc" id="L640"> } catch (ClassCastException e) {</span>
<span class="nc" id="L641"> log.debug(e);</span>
<span class="nc" id="L642"> mtasResponse.remove("facet");</span>
<span class="nc" id="L643"> }</span>
}
<span class="nc" id="L645"> }</span>
/**
* Gets the field type.
*
* @param schema the schema
* @param field the field
* @return the field type
*/
private String getFieldType(IndexSchema schema, String field) {
<span class="nc" id="L655"> SchemaField sf = schema.getField(field);</span>
<span class="nc" id="L656"> FieldType ft = sf.getType();</span>
<span class="nc bnc" id="L657" title="All 4 branches missed."> if (ft != null && ft.getNumericType() != null) {</span>
<span class="nc" id="L658"> LegacyNumericType nt = ft.getNumericType();</span>
<span class="nc bnc" id="L659" title="All 2 branches missed."> if (nt.equals(LegacyNumericType.INT)) {</span>
<span class="nc" id="L660"> return ComponentFacet.TYPE_INTEGER;</span>
<span class="nc bnc" id="L661" title="All 2 branches missed."> } else if (nt.equals(LegacyNumericType.DOUBLE)) {</span>
<span class="nc" id="L662"> return ComponentFacet.TYPE_DOUBLE;</span>
<span class="nc bnc" id="L663" title="All 2 branches missed."> } else if (nt.equals(LegacyNumericType.LONG)) {</span>
<span class="nc" id="L664"> return ComponentFacet.TYPE_LONG;</span>
<span class="nc bnc" id="L665" title="All 2 branches missed."> } else if (nt.equals(LegacyNumericType.FLOAT)) {</span>
<span class="nc" id="L666"> return ComponentFacet.TYPE_FLOAT;</span>
}
}
<span class="nc" id="L669"> return ComponentFacet.TYPE_STRING;</span>
}
/**
* Gets the positive integer.
*
* @param number the number
* @return the positive integer
*/
private int getPositiveInteger(String number) {
try {
<span class="nc" id="L680"> return Math.max(0, Integer.parseInt(number));</span>
<span class="nc" id="L681"> } catch (NumberFormatException e) {</span>
<span class="nc" id="L682"> return 0;</span>
}
}
/**
* Gets the double.
*
* @param number the number
* @return the double
*/
private Double getDouble(String number) {
try {
<span class="nc" id="L694"> return Double.parseDouble(number);</span>
<span class="nc" id="L695"> } catch (NumberFormatException e) {</span>
<span class="nc" id="L696"> return null;</span>
}
}
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.7.9.201702052155</span></div></body></html>