MtasSolrComponentFacet.java.html
47.3 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
702
703
704
705
706
707
708
709
710
<?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.index.DocValuesType;
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.NumberType;
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="L40"> private static final Log log = LogFactory</span>
<span class="fc" id="L41"> .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="L134"> public MtasSolrComponentFacet(MtasSolrSearchComponent searchComponent) {</span>
<span class="fc" id="L135"> this.searchComponent = searchComponent;</span>
<span class="fc" id="L136"> }</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="L148"> Set<String> ids = MtasSolrResultUtil</span>
<span class="nc" id="L149"> .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_FACET);</span>
<span class="nc bnc" id="L150" title="All 2 branches missed."> if (!ids.isEmpty()) {</span>
<span class="nc" id="L151"> int tmpCounter = 0;</span>
String tmpValue;
<span class="nc" id="L153"> String[] fields = new String[ids.size()];</span>
<span class="nc" id="L154"> String[] keys = new String[ids.size()];</span>
<span class="nc" id="L155"> String[][] queryTypes = new String[ids.size()][];</span>
<span class="nc" id="L156"> String[][] queryValues = new String[ids.size()][];</span>
<span class="nc" id="L157"> String[][] queryPrefixes = new String[ids.size()][];</span>
<span class="nc" id="L158"> String[][] queryIgnores = new String[ids.size()][];</span>
<span class="nc" id="L159"> String[][] queryMaximumIgnoreLengths = new String[ids.size()][];</span>
<span class="nc" id="L160"> HashMap<String, String[]>[][] queryVariables = new HashMap[ids.size()][];</span>
<span class="nc" id="L161"> String[][] baseFields = new String[ids.size()][];</span>
<span class="nc" id="L162"> String[][] baseFieldTypes = new String[ids.size()][];</span>
<span class="nc" id="L163"> String[][] baseTypes = new String[ids.size()][];</span>
<span class="nc" id="L164"> Double[][] baseRangeSizes = new Double[ids.size()][];</span>
<span class="nc" id="L165"> Double[][] baseRangeBases = new Double[ids.size()][];</span>
<span class="nc" id="L166"> String[][] baseSortTypes = new String[ids.size()][];</span>
<span class="nc" id="L167"> String[][] baseSortDirections = new String[ids.size()][];</span>
<span class="nc" id="L168"> Integer[][] baseNumbers = new Integer[ids.size()][];</span>
<span class="nc" id="L169"> Double[][] baseMinima = new Double[ids.size()][];</span>
<span class="nc" id="L170"> Double[][] baseMaxima = new Double[ids.size()][];</span>
<span class="nc" id="L171"> String[][][] baseFunctionExpressions = new String[ids.size()][][];</span>
<span class="nc" id="L172"> String[][][] baseFunctionKeys = new String[ids.size()][][];</span>
<span class="nc" id="L173"> String[][][] baseFunctionTypes = new String[ids.size()][][];</span>
<span class="nc bnc" id="L174" title="All 2 branches missed."> for (String id : ids) {</span>
<span class="nc" id="L175"> fields[tmpCounter] = rb.req.getParams().get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_FIELD, null);
<span class="nc" id="L177"> keys[tmpCounter] = rb.req.getParams()</span>
<span class="nc" id="L178"> .get(PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_KEY,</span>
<span class="nc" id="L179"> String.valueOf(tmpCounter))</span>
<span class="nc" id="L180"> .trim();</span>
<span class="nc" id="L181"> Set<String> qIds = MtasSolrResultUtil.getIdsFromParameters(</span>
<span class="nc" id="L182"> rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_QUERY);
<span class="nc bnc" id="L184" title="All 2 branches missed."> if (!qIds.isEmpty()) {</span>
<span class="nc" id="L185"> int tmpQCounter = 0;</span>
<span class="nc" id="L186"> queryTypes[tmpCounter] = new String[qIds.size()];</span>
<span class="nc" id="L187"> queryValues[tmpCounter] = new String[qIds.size()];</span>
<span class="nc" id="L188"> queryPrefixes[tmpCounter] = new String[qIds.size()];</span>
<span class="nc" id="L189"> queryIgnores[tmpCounter] = new String[qIds.size()];</span>
<span class="nc" id="L190"> queryMaximumIgnoreLengths[tmpCounter] = new String[qIds.size()];</span>
<span class="nc" id="L191"> queryVariables[tmpCounter] = new HashMap[qIds.size()];</span>
<span class="nc bnc" id="L192" title="All 2 branches missed."> for (String qId : qIds) {</span>
<span class="nc" id="L193"> queryTypes[tmpCounter][tmpQCounter] = rb.req.getParams()</span>
<span class="nc" id="L194"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_QUERY
+ "." + qId + "." + SUBNAME_MTAS_FACET_QUERY_TYPE,
null);
<span class="nc" id="L198"> queryValues[tmpCounter][tmpQCounter] = rb.req.getParams()</span>
<span class="nc" id="L199"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_QUERY
+ "." + qId + "." + SUBNAME_MTAS_FACET_QUERY_VALUE,
null);
<span class="nc" id="L203"> queryPrefixes[tmpCounter][tmpQCounter] = rb.req.getParams()</span>
<span class="nc" id="L204"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_QUERY
+ "." + qId + "." + SUBNAME_MTAS_FACET_QUERY_PREFIX,
null);
<span class="nc" id="L208"> queryIgnores[tmpCounter][tmpQCounter] = rb.req.getParams()</span>
<span class="nc" id="L209"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_QUERY
+ "." + qId + "." + SUBNAME_MTAS_FACET_QUERY_IGNORE,
null);
<span class="nc" id="L213"> queryMaximumIgnoreLengths[tmpCounter][tmpQCounter] = rb.req</span>
<span class="nc" id="L214"> .getParams()</span>
<span class="nc" id="L215"> .get(PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_QUERY</span>
+ "." + qId + "."
+ SUBNAME_MTAS_FACET_QUERY_MAXIMUM_IGNORE_LENGTH, null);
<span class="nc" id="L218"> Set<String> vIds = MtasSolrResultUtil.getIdsFromParameters(</span>
<span class="nc" id="L219"> rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_QUERY + "."
+ qId + "." + SUBNAME_MTAS_FACET_QUERY_VARIABLE);
<span class="nc" id="L222"> queryVariables[tmpCounter][tmpQCounter] = new HashMap<>();</span>
<span class="nc bnc" id="L223" title="All 2 branches missed."> if (!vIds.isEmpty()) {</span>
<span class="nc" id="L224"> HashMap<String, ArrayList<String>> tmpVariables = new HashMap<>();</span>
<span class="nc bnc" id="L225" title="All 2 branches missed."> for (String vId : vIds) {</span>
<span class="nc" id="L226"> 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="L230" title="All 2 branches missed."> if (name != null) {</span>
<span class="nc bnc" id="L231" title="All 2 branches missed."> if (!tmpVariables.containsKey(name)) {</span>
<span class="nc" id="L232"> tmpVariables.put(name, new ArrayList<String>());</span>
}
<span class="nc" id="L234"> 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="L238" title="All 2 branches missed."> if (value != null) {</span>
<span class="nc" id="L239"> ArrayList<String> list = new ArrayList<>();</span>
<span class="nc" id="L240"> String[] subList = value.split("(?<!\\\\),");</span>
<span class="nc bnc" id="L241" title="All 2 branches missed."> for (int i = 0; i < subList.length; i++) {</span>
<span class="nc" id="L242"> list.add(</span>
<span class="nc" id="L243"> subList[i].replace("\\,", ",").replace("\\\\", "\\"));</span>
}
<span class="nc" id="L245"> tmpVariables.get(name).addAll(list);</span>
}
}
<span class="nc" id="L248"> }</span>
<span class="nc bnc" id="L249" title="All 2 branches missed."> for (Entry<String, ArrayList<String>> entry : tmpVariables</span>
<span class="nc" id="L250"> .entrySet()) {</span>
<span class="nc" id="L251"> queryVariables[tmpCounter][tmpQCounter].put(entry.getKey(),</span>
<span class="nc" id="L252"> entry.getValue()</span>
<span class="nc" id="L253"> .toArray(new String[entry.getValue().size()]));</span>
<span class="nc" id="L254"> }</span>
}
<span class="nc" id="L256"> tmpQCounter++;</span>
<span class="nc" id="L257"> }</span>
<span class="nc" id="L258"> } else {</span>
<span class="nc" id="L259"> throw new IOException(</span>
"no " + NAME_MTAS_FACET_QUERY + " for mtas facet " + id);
}
<span class="nc" id="L262"> Set<String> bIds = MtasSolrResultUtil.getIdsFromParameters(</span>
<span class="nc" id="L263"> rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE);
<span class="nc bnc" id="L265" title="All 2 branches missed."> if (!bIds.isEmpty()) {</span>
<span class="nc" id="L266"> int tmpBCounter = 0;</span>
<span class="nc" id="L267"> baseFields[tmpCounter] = new String[bIds.size()];</span>
<span class="nc" id="L268"> baseFieldTypes[tmpCounter] = new String[bIds.size()];</span>
<span class="nc" id="L269"> baseTypes[tmpCounter] = new String[bIds.size()];</span>
<span class="nc" id="L270"> baseRangeSizes[tmpCounter] = new Double[bIds.size()];</span>
<span class="nc" id="L271"> baseRangeBases[tmpCounter] = new Double[bIds.size()];</span>
<span class="nc" id="L272"> baseSortTypes[tmpCounter] = new String[bIds.size()];</span>
<span class="nc" id="L273"> baseSortDirections[tmpCounter] = new String[bIds.size()];</span>
<span class="nc" id="L274"> baseNumbers[tmpCounter] = new Integer[bIds.size()];</span>
<span class="nc" id="L275"> baseMinima[tmpCounter] = new Double[bIds.size()];</span>
<span class="nc" id="L276"> baseMaxima[tmpCounter] = new Double[bIds.size()];</span>
<span class="nc" id="L277"> baseFunctionKeys[tmpCounter] = new String[bIds.size()][];</span>
<span class="nc" id="L278"> baseFunctionExpressions[tmpCounter] = new String[bIds.size()][];</span>
<span class="nc" id="L279"> baseFunctionTypes[tmpCounter] = new String[bIds.size()][];</span>
<span class="nc bnc" id="L280" title="All 2 branches missed."> for (String bId : bIds) {</span>
<span class="nc" id="L281"> baseFields[tmpCounter][tmpBCounter] = rb.req.getParams()</span>
<span class="nc" id="L282"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_FIELD,
null);
<span class="nc" id="L286"> baseFieldTypes[tmpCounter][tmpBCounter] = getFieldType(</span>
<span class="nc" id="L287"> rb.req.getSchema(), baseFields[tmpCounter][tmpBCounter]);</span>
<span class="nc" id="L288"> baseTypes[tmpCounter][tmpBCounter] = rb.req.getParams()</span>
<span class="nc" id="L289"> .get(PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE</span>
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_TYPE, null);
<span class="nc" id="L291"> tmpValue = rb.req.getParams()</span>
<span class="nc" id="L292"> .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="L295" title="All 2 branches missed."> baseRangeSizes[tmpCounter][tmpBCounter] = tmpValue == null ? null</span>
<span class="nc" id="L296"> : Double.parseDouble(tmpValue);</span>
<span class="nc" id="L297"> tmpValue = rb.req.getParams()</span>
<span class="nc" id="L298"> .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="L301" title="All 2 branches missed."> baseRangeBases[tmpCounter][tmpBCounter] = tmpValue == null ? null</span>
<span class="nc" id="L302"> : Double.parseDouble(tmpValue);</span>
<span class="nc" id="L303"> baseSortTypes[tmpCounter][tmpBCounter] = rb.req.getParams()</span>
<span class="nc" id="L304"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_SORT_TYPE,
null);
<span class="nc" id="L308"> baseSortDirections[tmpCounter][tmpBCounter] = rb.req.getParams()</span>
<span class="nc" id="L309"> .get(PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE</span>
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_SORT_DIRECTION,
null);
<span class="nc" id="L312"> tmpValue = rb.req.getParams()</span>
<span class="nc" id="L313"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_NUMBER,
null);
<span class="nc bnc" id="L317" title="All 2 branches missed."> baseNumbers[tmpCounter][tmpBCounter] = tmpValue != null</span>
<span class="nc" id="L318"> ? getPositiveInteger(tmpValue) : null;</span>
<span class="nc" id="L319"> tmpValue = rb.req.getParams()</span>
<span class="nc" id="L320"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_MINIMUM,
null);
<span class="nc bnc" id="L324" title="All 2 branches missed."> baseMinima[tmpCounter][tmpBCounter] = tmpValue != null</span>
<span class="nc" id="L325"> ? getDouble(tmpValue) : null;</span>
<span class="nc" id="L326"> tmpValue = rb.req.getParams()</span>
<span class="nc" id="L327"> .get(</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE
+ "." + bId + "." + SUBNAME_MTAS_FACET_BASE_MAXIMUM,
null);
<span class="nc bnc" id="L331" title="All 2 branches missed."> baseMaxima[tmpCounter][tmpBCounter] = tmpValue != null</span>
<span class="nc" id="L332"> ? getDouble(tmpValue) : null;</span>
<span class="nc" id="L333"> Set<String> functionIds = MtasSolrResultUtil.getIdsFromParameters(</span>
<span class="nc" id="L334"> rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + id + "." + NAME_MTAS_FACET_BASE + "."
+ bId + "." + SUBNAME_MTAS_FACET_BASE_FUNCTION);
<span class="nc" id="L337"> baseFunctionExpressions[tmpCounter][tmpBCounter] = new String[functionIds</span>
<span class="nc" id="L338"> .size()];</span>
<span class="nc" id="L339"> baseFunctionKeys[tmpCounter][tmpBCounter] = new String[functionIds</span>
<span class="nc" id="L340"> .size()];</span>
<span class="nc" id="L341"> baseFunctionTypes[tmpCounter][tmpBCounter] = new String[functionIds</span>
<span class="nc" id="L342"> .size()];</span>
<span class="nc" id="L343"> int tmpSubCounter = 0;</span>
<span class="nc bnc" id="L344" title="All 2 branches missed."> for (String functionId : functionIds) {</span>
<span class="nc" id="L345"> baseFunctionKeys[tmpCounter][tmpBCounter][tmpSubCounter] = rb.req</span>
<span class="nc" id="L346"> .getParams()</span>
<span class="nc" id="L347"> .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="L350"> String.valueOf(tmpSubCounter))</span>
<span class="nc" id="L351"> .trim();</span>
<span class="nc" id="L352"> baseFunctionExpressions[tmpCounter][tmpBCounter][tmpSubCounter] = rb.req</span>
<span class="nc" id="L353"> .getParams()</span>
<span class="nc" id="L354"> .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="L358"> baseFunctionTypes[tmpCounter][tmpBCounter][tmpSubCounter] = rb.req</span>
<span class="nc" id="L359"> .getParams()</span>
<span class="nc" id="L360"> .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="L364"> tmpSubCounter++;</span>
<span class="nc" id="L365"> }</span>
<span class="nc" id="L366"> tmpBCounter++;</span>
<span class="nc" id="L367"> }</span>
<span class="nc" id="L368"> } else {</span>
<span class="nc" id="L369"> throw new IOException(</span>
"no " + NAME_MTAS_FACET_BASE + " for mtas facet " + id);
}
<span class="nc" id="L372"> tmpCounter++;</span>
<span class="nc" id="L373"> }</span>
<span class="nc" id="L374"> String uniqueKeyField = rb.req.getSchema().getUniqueKeyField().getName();</span>
<span class="nc" id="L375"> mtasFields.doFacet = true;</span>
<span class="nc" id="L376"> rb.setNeedDocSet(true);</span>
<span class="nc bnc" id="L377" title="All 2 branches missed."> for (String field : fields) {</span>
<span class="nc bnc" id="L378" title="All 4 branches missed."> if (field == null || field.isEmpty()) {</span>
<span class="nc" id="L379"> throw new IOException("no (valid) field in mtas facet");</span>
<span class="nc bnc" id="L380" title="All 2 branches missed."> } else if (!mtasFields.list.containsKey(field)) {</span>
<span class="nc" id="L381"> mtasFields.list.put(field, new ComponentField(uniqueKeyField));</span>
}
}
<span class="nc" id="L384"> MtasSolrResultUtil.compareAndCheck(keys, fields, NAME_MTAS_FACET_KEY,</span>
<span class="nc" id="L385"> NAME_MTAS_FACET_FIELD, true);</span>
<span class="nc bnc" id="L386" title="All 2 branches missed."> for (int i = 0; i < fields.length; i++) {</span>
<span class="nc" id="L387"> ComponentField cf = mtasFields.list.get(fields[i]);</span>
<span class="nc" id="L388"> int queryNumber = queryValues[i].length;</span>
<span class="nc" id="L389"> MtasSpanQuery[] ql = new MtasSpanQuery[queryNumber];</span>
<span class="nc bnc" id="L390" title="All 2 branches missed."> for (int j = 0; j < queryNumber; j++) {</span>
<span class="nc bnc" id="L391" title="All 2 branches missed."> Integer maximumIgnoreLength = (queryMaximumIgnoreLengths[i][j] == null)</span>
<span class="nc" id="L392"> ? null : Integer.parseInt(queryMaximumIgnoreLengths[i][j]);</span>
<span class="nc" id="L393"> 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="L397" title="All 2 branches missed."> if (cf.spanQueryList.contains(q)) {</span>
<span class="nc" id="L398"> q = cf.spanQueryList.get(cf.spanQueryList.indexOf(q));</span>
} else {
<span class="nc" id="L400"> cf.spanQueryList.add(q);</span>
}
<span class="nc" id="L402"> ql[j] = q;</span>
}
<span class="nc bnc" id="L404" title="All 4 branches missed."> String key = (keys[i] == null) || (keys[i].isEmpty())</span>
<span class="nc" id="L405"> ? String.valueOf(i) + ":" + fields[i] : keys[i].trim();</span>
try {
<span class="nc" id="L407"> 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="L413"> } catch (ParseException e) {</span>
<span class="nc" id="L414"> throw new IOException(e.getMessage());</span>
<span class="nc" id="L415"> }</span>
}
}
<span class="nc" id="L418"> }</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="L431" title="All 2 branches missed."> if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)</span>
<span class="nc bnc" id="L432" title="All 2 branches missed."> && sreq.params.getBool(PARAM_MTAS_FACET, false)) {</span>
<span class="nc bnc" id="L433" 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="L437"> Set<String> keys = MtasSolrResultUtil</span>
<span class="nc" id="L438"> .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_FACET);</span>
<span class="nc" id="L439"> sreq.params.remove(PARAM_MTAS_FACET);</span>
<span class="nc bnc" id="L440" title="All 2 branches missed."> for (String key : keys) {</span>
<span class="nc" id="L441"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_FIELD);
<span class="nc" id="L443"> sreq.params</span>
<span class="nc" id="L444"> .remove(PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_KEY);</span>
<span class="nc" id="L445"> Set<String> subKeys = MtasSolrResultUtil.getIdsFromParameters(</span>
<span class="nc" id="L446"> rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY);
<span class="nc bnc" id="L448" title="All 2 branches missed."> for (String subKey : subKeys) {</span>
<span class="nc" id="L449"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY + "."
+ subKey + "." + SUBNAME_MTAS_FACET_QUERY_TYPE);
<span class="nc" id="L452"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY + "."
+ subKey + "." + SUBNAME_MTAS_FACET_QUERY_VALUE);
<span class="nc" id="L455"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY + "."
+ subKey + "." + SUBNAME_MTAS_FACET_QUERY_PREFIX);
<span class="nc" id="L458"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY + "."
+ subKey + "." + SUBNAME_MTAS_FACET_QUERY_IGNORE);
<span class="nc" id="L461"> sreq.params.remove(PARAM_MTAS_FACET + "." + key + "."</span>
+ NAME_MTAS_FACET_QUERY + "." + subKey + "."
+ SUBNAME_MTAS_FACET_QUERY_MAXIMUM_IGNORE_LENGTH);
<span class="nc" id="L464"> Set<String> subSubKeys = MtasSolrResultUtil</span>
<span class="nc" id="L465"> .getIdsFromParameters(rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY
+ "." + subKey + "."
+ SUBNAME_MTAS_FACET_QUERY_VARIABLE);
<span class="nc bnc" id="L469" title="All 2 branches missed."> for (String subSubKey : subSubKeys) {</span>
<span class="nc" id="L470"> 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="L474"> 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="L478"> }</span>
<span class="nc" id="L479"> }</span>
<span class="nc" id="L480"> subKeys = MtasSolrResultUtil.getIdsFromParameters(rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE);
<span class="nc bnc" id="L482" title="All 2 branches missed."> for (String subKey : subKeys) {</span>
<span class="nc" id="L483"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_FIELD);
<span class="nc" id="L486"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_TYPE);
<span class="nc" id="L489"> 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="L493"> 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="L497"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_MAXIMUM);
<span class="nc" id="L500"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_MINIMUM);
<span class="nc" id="L503"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_NUMBER);
<span class="nc" id="L506"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_SORT_DIRECTION);
<span class="nc" id="L509"> sreq.params.remove(</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
+ subKey + "." + SUBNAME_MTAS_FACET_BASE_SORT_TYPE);
<span class="nc" id="L512"> Set<String> subSubKeys = MtasSolrResultUtil</span>
<span class="nc" id="L513"> .getIdsFromParameters(rb.req.getParams(),</span>
PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE
+ "." + subKey + "."
+ SUBNAME_MTAS_FACET_BASE_FUNCTION);
<span class="nc bnc" id="L517" title="All 2 branches missed."> for (String subSubKey : subSubKeys) {</span>
<span class="nc" id="L518"> 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="L522"> 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="L526"> 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="L530"> }</span>
<span class="nc" id="L531"> }</span>
<span class="nc" id="L532"> }</span>
}
}
<span class="nc" id="L535"> }</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="L546"> SimpleOrderedMap<Object> mtasFacetResponse = new SimpleOrderedMap<>();</span>
<span class="nc" id="L547"> mtasFacetResponse.add("key", facet.key);</span>
<span class="nc" id="L548"> HashMap<MtasDataCollector<?, ?>, HashMap<String, MtasSolrMtasResult>> functionData = new HashMap<>();</span>
<span class="nc bnc" id="L549" title="All 2 branches missed."> for (int i = 0; i < facet.baseFields.length; i++) {</span>
<span class="nc bnc" id="L550" title="All 2 branches missed."> if (facet.baseFunctionList[i] != null) {</span>
<span class="nc bnc" id="L551" title="All 2 branches missed."> for (MtasDataCollector<?, ?> functionDataCollector : facet.baseFunctionList[i]</span>
<span class="nc" id="L552"> .keySet()) {</span>
<span class="nc" id="L553"> SubComponentFunction[] tmpSubComponentFunctionList = facet.baseFunctionList[i]</span>
<span class="nc" id="L554"> .get(functionDataCollector);</span>
<span class="nc bnc" id="L555" title="All 2 branches missed."> if (tmpSubComponentFunctionList != null) {</span>
<span class="nc" id="L556"> HashMap<String, MtasSolrMtasResult> tmpList = new HashMap<>();</span>
<span class="nc bnc" id="L557" title="All 2 branches missed."> for (SubComponentFunction tmpSubComponentFunction : tmpSubComponentFunctionList) {</span>
<span class="nc" id="L558"> tmpList.put(tmpSubComponentFunction.key,</span>
new MtasSolrMtasResult(tmpSubComponentFunction.dataCollector,
tmpSubComponentFunction.dataType,
tmpSubComponentFunction.statsType,
tmpSubComponentFunction.statsItems, null));
}
<span class="nc" id="L564"> functionData.put(functionDataCollector, tmpList);</span>
}
<span class="nc" id="L566"> }</span>
}
}
<span class="nc" id="L569"> 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="L574" title="All 2 branches missed."> if (encode) {</span>
<span class="nc" id="L575"> mtasFacetResponse.add("_encoded_list", MtasSolrResultUtil.encode(data));</span>
} else {
<span class="nc" id="L577"> mtasFacetResponse.add("list", data);</span>
<span class="nc" id="L578"> MtasSolrResultUtil.rewrite(mtasFacetResponse, searchComponent);</span>
}
<span class="nc" id="L580"> 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="L592" 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="L595" title="All 2 branches missed."> for (ShardRequest sreq : rb.finished) {</span>
<span class="nc bnc" id="L596" title="All 2 branches missed."> if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)</span>
<span class="nc bnc" id="L597" title="All 2 branches missed."> && sreq.params.getBool(PARAM_MTAS_FACET, false)) {</span>
<span class="nc bnc" id="L598" title="All 2 branches missed."> for (ShardResponse shardResponse : sreq.responses) {</span>
<span class="nc" id="L599"> NamedList<Object> response = shardResponse.getSolrResponse()</span>
<span class="nc" id="L600"> .getResponse();</span>
try {
<span class="nc" id="L602"> ArrayList<NamedList<Object>> data = (ArrayList<NamedList<Object>>) response</span>
<span class="nc" id="L603"> .findRecursive("mtas", "facet");</span>
<span class="nc bnc" id="L604" title="All 2 branches missed."> if (data != null) {</span>
<span class="nc" id="L605"> MtasSolrResultUtil.decode(data);</span>
}
<span class="nc" id="L607"> } catch (ClassCastException e) {</span>
<span class="nc" id="L608"> log.debug(e);</span>
// shouldn't happen
<span class="nc" id="L610"> }</span>
<span class="nc" id="L611"> }</span>
}
<span class="nc" id="L613"> }</span>
}
<span class="nc" id="L615"> }</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="L629"> NamedList<Object> mtasResponse = null;</span>
try {
<span class="nc" id="L631"> mtasResponse = (NamedList<Object>) rb.rsp.getValues().get("mtas");</span>
<span class="nc" id="L632"> } catch (ClassCastException e) {</span>
<span class="nc" id="L633"> log.debug(e);</span>
<span class="nc" id="L634"> mtasResponse = null;</span>
<span class="nc" id="L635"> }</span>
<span class="nc bnc" id="L636" title="All 2 branches missed."> if (mtasResponse != null) {</span>
ArrayList<Object> mtasResponseFacet;
try {
<span class="nc" id="L639"> mtasResponseFacet = (ArrayList<Object>) mtasResponse.get("facet");</span>
<span class="nc bnc" id="L640" title="All 2 branches missed."> if (mtasResponseFacet != null) {</span>
<span class="nc" id="L641"> MtasSolrResultUtil.rewrite(mtasResponseFacet, searchComponent);</span>
}
<span class="nc" id="L643"> } catch (ClassCastException e) {</span>
<span class="nc" id="L644"> log.debug(e);</span>
<span class="nc" id="L645"> mtasResponse.remove("facet");</span>
<span class="nc" id="L646"> }</span>
}
<span class="nc" id="L648"> }</span>
/**
* Gets the field type.
*
* @param schema
* the schema
* @param field
* the field
* @return the field type
* @throws IOException
*/
private String getFieldType(IndexSchema schema, String field) throws IOException {
<span class="nc" id="L661"> SchemaField sf = schema.getField(field);</span>
<span class="nc" id="L662"> FieldType ft = sf.getType();</span>
<span class="nc bnc" id="L663" title="All 2 branches missed."> if (ft != null) {</span>
<span class="nc bnc" id="L664" title="All 4 branches missed."> if(ft.isPointField() && !sf.hasDocValues()) {</span>
<span class="nc" id="L665"> return ComponentFacet.TYPE_POINTFIELD_WITHOUT_DOCVALUES;</span>
}
<span class="nc" id="L667"> NumberType nt = ft.getNumberType(); </span>
<span class="nc bnc" id="L668" title="All 2 branches missed."> if(nt!=null) {</span>
<span class="nc" id="L669"> return nt.name();</span>
} else {
<span class="nc" id="L671"> return ComponentFacet.TYPE_STRING;</span>
}
} else {
//best guess
<span class="nc" id="L675"> 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="L688"> return Math.max(0, Integer.parseInt(number));</span>
<span class="nc" id="L689"> } catch (NumberFormatException e) {</span>
<span class="nc" id="L690"> return 0;</span>
}
}
/**
* Gets the double.
*
* @param number
* the number
* @return the double
*/
private Double getDouble(String number) {
try {
<span class="nc" id="L703"> return Double.parseDouble(number);</span>
<span class="nc" id="L704"> } catch (NumberFormatException e) {</span>
<span class="nc" id="L705"> 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>