MtasSolrComponentList.java.html
48.2 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
<?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>MtasSolrComponentList.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">MtasSolrComponentList.java</span></div><h1>MtasSolrComponentList.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.List;
import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.solr.common.params.ModifiableSolrParams;
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 mtas.analysis.token.MtasToken;
import mtas.codec.util.CodecUtil;
import mtas.search.spans.util.MtasSpanQuery;
import mtas.codec.util.CodecComponent.ComponentField;
import mtas.codec.util.CodecComponent.ComponentFields;
import mtas.codec.util.CodecComponent.ComponentList;
import mtas.codec.util.CodecComponent.ListHit;
import mtas.codec.util.CodecComponent.ListToken;
import mtas.solr.handler.component.MtasSolrSearchComponent;
/**
* The Class MtasSolrComponentList.
*/
public class MtasSolrComponentList implements MtasSolrComponent<ComponentList> {
/** The Constant log. */
<span class="fc" id="L38"> private static final Log log = LogFactory.getLog(MtasSolrComponentList.class);</span>
/** The search component. */
MtasSolrSearchComponent searchComponent;
/** The Constant PARAM_MTAS_LIST. */
public static final String PARAM_MTAS_LIST = MtasSolrSearchComponent.PARAM_MTAS
+ ".list";
/** The Constant NAME_MTAS_LIST_FIELD. */
public static final String NAME_MTAS_LIST_FIELD = "field";
/** The Constant NAME_MTAS_LIST_QUERY_TYPE. */
public static final String NAME_MTAS_LIST_QUERY_TYPE = "query.type";
/** The Constant NAME_MTAS_LIST_QUERY_VALUE. */
public static final String NAME_MTAS_LIST_QUERY_VALUE = "query.value";
/** The Constant NAME_MTAS_LIST_QUERY_PREFIX. */
public static final String NAME_MTAS_LIST_QUERY_PREFIX = "query.prefix";
/** The Constant NAME_MTAS_LIST_QUERY_IGNORE. */
public static final String NAME_MTAS_LIST_QUERY_IGNORE = "query.ignore";
/** The Constant NAME_MTAS_LIST_QUERY_MAXIMUM_IGNORE_LENGTH. */
public static final String NAME_MTAS_LIST_QUERY_MAXIMUM_IGNORE_LENGTH = "query.maximumIgnoreLength";
/** The Constant NAME_MTAS_LIST_QUERY_VARIABLE. */
public static final String NAME_MTAS_LIST_QUERY_VARIABLE = "query.variable";
/** The Constant SUBNAME_MTAS_LIST_QUERY_VARIABLE_NAME. */
public static final String SUBNAME_MTAS_LIST_QUERY_VARIABLE_NAME = "name";
/** The Constant SUBNAME_MTAS_LIST_QUERY_VARIABLE_VALUE. */
public static final String SUBNAME_MTAS_LIST_QUERY_VARIABLE_VALUE = "value";
/** The Constant NAME_MTAS_LIST_KEY. */
public static final String NAME_MTAS_LIST_KEY = "key";
/** The Constant NAME_MTAS_LIST_PREFIX. */
public static final String NAME_MTAS_LIST_PREFIX = "prefix";
/** The Constant NAME_MTAS_LIST_START. */
public static final String NAME_MTAS_LIST_START = "start";
/** The Constant NAME_MTAS_LIST_NUMBER. */
public static final String NAME_MTAS_LIST_NUMBER = "number";
/** The Constant NAME_MTAS_LIST_LEFT. */
public static final String NAME_MTAS_LIST_LEFT = "left";
/** The Constant NAME_MTAS_LIST_RIGHT. */
public static final String NAME_MTAS_LIST_RIGHT = "right";
/** The Constant NAME_MTAS_LIST_OUTPUT. */
public static final String NAME_MTAS_LIST_OUTPUT = "output";
/**
* Instantiates a new mtas solr component list.
*
* @param searchComponent the search component
*/
<span class="fc" id="L100"> public MtasSolrComponentList(MtasSolrSearchComponent searchComponent) {</span>
<span class="fc" id="L101"> this.searchComponent = searchComponent;</span>
<span class="fc" id="L102"> }</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="L114"> Set<String> ids = MtasSolrResultUtil</span>
<span class="nc" id="L115"> .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_LIST);</span>
<span class="nc bnc" id="L116" title="All 2 branches missed."> if (!ids.isEmpty()) {</span>
<span class="nc" id="L117"> int tmpCounter = 0;</span>
<span class="nc" id="L118"> String[] fields = new String[ids.size()];</span>
<span class="nc" id="L119"> String[] queryTypes = new String[ids.size()];</span>
<span class="nc" id="L120"> String[] queryValues = new String[ids.size()];</span>
<span class="nc" id="L121"> String[] queryPrefixes = new String[ids.size()];</span>
<span class="nc" id="L122"> HashMap<String, String[]>[] queryVariables = new HashMap[ids.size()];</span>
<span class="nc" id="L123"> String[] queryIgnores = new String[ids.size()];</span>
<span class="nc" id="L124"> String[] queryMaximumIgnoreLengths = new String[ids.size()];</span>
<span class="nc" id="L125"> String[] keys = new String[ids.size()];</span>
<span class="nc" id="L126"> String[] prefixes = new String[ids.size()];</span>
<span class="nc" id="L127"> String[] starts = new String[ids.size()];</span>
<span class="nc" id="L128"> String[] numbers = new String[ids.size()];</span>
<span class="nc" id="L129"> String[] lefts = new String[ids.size()];</span>
<span class="nc" id="L130"> String[] rights = new String[ids.size()];</span>
<span class="nc" id="L131"> String[] outputs = new String[ids.size()];</span>
<span class="nc bnc" id="L132" title="All 2 branches missed."> for (String id : ids) {</span>
<span class="nc" id="L133"> fields[tmpCounter] = rb.req.getParams()</span>
<span class="nc" id="L134"> .get(PARAM_MTAS_LIST + "." + id + "." + NAME_MTAS_LIST_FIELD, null);</span>
<span class="nc" id="L135"> keys[tmpCounter] = rb.req.getParams()</span>
<span class="nc" id="L136"> .get(PARAM_MTAS_LIST + "." + id + "." + NAME_MTAS_LIST_KEY,</span>
<span class="nc" id="L137"> String.valueOf(tmpCounter))</span>
<span class="nc" id="L138"> .trim();</span>
<span class="nc" id="L139"> queryTypes[tmpCounter] = rb.req.getParams().get(</span>
PARAM_MTAS_LIST + "." + id + "." + NAME_MTAS_LIST_QUERY_TYPE, null);
<span class="nc" id="L141"> queryValues[tmpCounter] = rb.req.getParams().get(</span>
PARAM_MTAS_LIST + "." + id + "." + NAME_MTAS_LIST_QUERY_VALUE,
null);
<span class="nc" id="L144"> queryPrefixes[tmpCounter] = rb.req.getParams().get(</span>
PARAM_MTAS_LIST + "." + id + "." + NAME_MTAS_LIST_QUERY_PREFIX,
null);
<span class="nc" id="L147"> queryIgnores[tmpCounter] = rb.req.getParams().get(</span>
PARAM_MTAS_LIST + "." + id + "." + NAME_MTAS_LIST_QUERY_IGNORE,
null);
<span class="nc" id="L150"> queryMaximumIgnoreLengths[tmpCounter] = rb.req.getParams()</span>
<span class="nc" id="L151"> .get(PARAM_MTAS_LIST + "." + id + "."</span>
+ NAME_MTAS_LIST_QUERY_MAXIMUM_IGNORE_LENGTH, null);
<span class="nc" id="L153"> Set<String> vIds = MtasSolrResultUtil.getIdsFromParameters(</span>
<span class="nc" id="L154"> rb.req.getParams(),</span>
PARAM_MTAS_LIST + "." + id + "." + NAME_MTAS_LIST_QUERY_VARIABLE);
<span class="nc" id="L156"> queryVariables[tmpCounter] = new HashMap<>();</span>
<span class="nc bnc" id="L157" title="All 2 branches missed."> if (!vIds.isEmpty()) {</span>
<span class="nc" id="L158"> HashMap<String, ArrayList<String>> tmpVariables = new HashMap<>();</span>
<span class="nc bnc" id="L159" title="All 2 branches missed."> for (String vId : vIds) {</span>
<span class="nc" id="L160"> String name = rb.req.getParams().get(</span>
PARAM_MTAS_LIST + "." + id + "." + NAME_MTAS_LIST_QUERY_VARIABLE
+ "." + vId + "." + SUBNAME_MTAS_LIST_QUERY_VARIABLE_NAME,
null);
<span class="nc bnc" id="L164" title="All 2 branches missed."> if (name != null) {</span>
<span class="nc bnc" id="L165" title="All 2 branches missed."> if (!tmpVariables.containsKey(name)) {</span>
<span class="nc" id="L166"> tmpVariables.put(name, new ArrayList<String>());</span>
}
<span class="nc" id="L168"> String value = rb.req.getParams()</span>
<span class="nc" id="L169"> .get(PARAM_MTAS_LIST + "." + id + "."</span>
+ NAME_MTAS_LIST_QUERY_VARIABLE + "." + vId + "."
+ SUBNAME_MTAS_LIST_QUERY_VARIABLE_VALUE, null);
<span class="nc bnc" id="L172" title="All 2 branches missed."> if (value != null) {</span>
<span class="nc" id="L173"> ArrayList<String> list = new ArrayList<>();</span>
<span class="nc" id="L174"> String[] subList = value.split("(?<!\\\\),");</span>
<span class="nc bnc" id="L175" title="All 2 branches missed."> for (int i = 0; i < subList.length; i++) {</span>
<span class="nc" id="L176"> list.add(</span>
<span class="nc" id="L177"> subList[i].replace("\\,", ",").replace("\\\\", "\\"));</span>
}
<span class="nc" id="L179"> tmpVariables.get(name).addAll(list);</span>
}
}
<span class="nc" id="L182"> }</span>
<span class="nc bnc" id="L183" title="All 2 branches missed."> for (Entry<String, ArrayList<String>> entry : tmpVariables</span>
<span class="nc" id="L184"> .entrySet()) {</span>
<span class="nc" id="L185"> queryVariables[tmpCounter].put(entry.getKey(),</span>
<span class="nc" id="L186"> entry.getValue().toArray(new String[entry.getValue().size()]));</span>
<span class="nc" id="L187"> }</span>
}
<span class="nc" id="L189"> prefixes[tmpCounter] = rb.req.getParams().get(</span>
PARAM_MTAS_LIST + "." + id + "." + NAME_MTAS_LIST_PREFIX, null);
<span class="nc" id="L191"> starts[tmpCounter] = rb.req.getParams()</span>
<span class="nc" id="L192"> .get(PARAM_MTAS_LIST + "." + id + "." + NAME_MTAS_LIST_START, null);</span>
<span class="nc" id="L193"> numbers[tmpCounter] = rb.req.getParams().get(</span>
PARAM_MTAS_LIST + "." + id + "." + NAME_MTAS_LIST_NUMBER, null);
<span class="nc" id="L195"> lefts[tmpCounter] = rb.req.getParams()</span>
<span class="nc" id="L196"> .get(PARAM_MTAS_LIST + "." + id + "." + NAME_MTAS_LIST_LEFT, null);</span>
<span class="nc" id="L197"> rights[tmpCounter] = rb.req.getParams()</span>
<span class="nc" id="L198"> .get(PARAM_MTAS_LIST + "." + id + "." + NAME_MTAS_LIST_RIGHT, null);</span>
<span class="nc" id="L199"> outputs[tmpCounter] = rb.req.getParams().get(</span>
PARAM_MTAS_LIST + "." + id + "." + NAME_MTAS_LIST_OUTPUT, null);
<span class="nc" id="L201"> tmpCounter++;</span>
<span class="nc" id="L202"> }</span>
<span class="nc" id="L203"> String uniqueKeyField = rb.req.getSchema().getUniqueKeyField().getName();</span>
<span class="nc" id="L204"> mtasFields.doList = true;</span>
<span class="nc" id="L205"> rb.setNeedDocSet(true);</span>
<span class="nc bnc" id="L206" title="All 2 branches missed."> for (String field : fields) {</span>
<span class="nc bnc" id="L207" title="All 4 branches missed."> if (field == null || field.isEmpty()) {</span>
<span class="nc" id="L208"> throw new IOException("no (valid) field in mtas list");</span>
<span class="nc bnc" id="L209" title="All 2 branches missed."> } else if (!mtasFields.list.containsKey(field)) {</span>
<span class="nc" id="L210"> mtasFields.list.put(field, new ComponentField(uniqueKeyField));</span>
}
}
<span class="nc" id="L213"> MtasSolrResultUtil.compareAndCheck(keys, fields, NAME_MTAS_LIST_KEY,</span>
<span class="nc" id="L214"> NAME_MTAS_LIST_FIELD, true);</span>
<span class="nc" id="L215"> MtasSolrResultUtil.compareAndCheck(prefixes, queryValues,</span>
<span class="nc" id="L216"> NAME_MTAS_LIST_QUERY_VALUE, NAME_MTAS_LIST_FIELD, false);</span>
<span class="nc" id="L217"> MtasSolrResultUtil.compareAndCheck(prefixes, queryTypes,</span>
<span class="nc" id="L218"> NAME_MTAS_LIST_QUERY_TYPE, NAME_MTAS_LIST_FIELD, false);</span>
<span class="nc" id="L219"> MtasSolrResultUtil.compareAndCheck(prefixes, queryPrefixes,</span>
<span class="nc" id="L220"> NAME_MTAS_LIST_QUERY_PREFIX, NAME_MTAS_LIST_FIELD, false);</span>
<span class="nc" id="L221"> MtasSolrResultUtil.compareAndCheck(prefixes, queryIgnores,</span>
<span class="nc" id="L222"> NAME_MTAS_LIST_QUERY_IGNORE, NAME_MTAS_LIST_FIELD, false);</span>
<span class="nc" id="L223"> MtasSolrResultUtil.compareAndCheck(prefixes, queryMaximumIgnoreLengths,</span>
NAME_MTAS_LIST_QUERY_MAXIMUM_IGNORE_LENGTH, NAME_MTAS_LIST_FIELD,
<span class="nc" id="L225"> false);</span>
<span class="nc" id="L226"> MtasSolrResultUtil.compareAndCheck(prefixes, fields,</span>
<span class="nc" id="L227"> NAME_MTAS_LIST_PREFIX, NAME_MTAS_LIST_FIELD, false);</span>
<span class="nc" id="L228"> MtasSolrResultUtil.compareAndCheck(starts, fields, NAME_MTAS_LIST_START,</span>
<span class="nc" id="L229"> NAME_MTAS_LIST_FIELD, false);</span>
<span class="nc" id="L230"> MtasSolrResultUtil.compareAndCheck(numbers, fields, NAME_MTAS_LIST_NUMBER,</span>
<span class="nc" id="L231"> NAME_MTAS_LIST_FIELD, false);</span>
<span class="nc" id="L232"> MtasSolrResultUtil.compareAndCheck(lefts, fields, NAME_MTAS_LIST_LEFT,</span>
<span class="nc" id="L233"> NAME_MTAS_LIST_FIELD, false);</span>
<span class="nc" id="L234"> MtasSolrResultUtil.compareAndCheck(rights, fields, NAME_MTAS_LIST_RIGHT,</span>
<span class="nc" id="L235"> NAME_MTAS_LIST_FIELD, false);</span>
<span class="nc" id="L236"> MtasSolrResultUtil.compareAndCheck(outputs, fields, NAME_MTAS_LIST_OUTPUT,</span>
<span class="nc" id="L237"> NAME_MTAS_LIST_FIELD, false);</span>
<span class="nc bnc" id="L238" title="All 2 branches missed."> for (int i = 0; i < fields.length; i++) {</span>
<span class="nc" id="L239"> ComponentField cf = mtasFields.list.get(fields[i]);</span>
<span class="nc bnc" id="L240" title="All 2 branches missed."> Integer maximumIgnoreLength = (queryMaximumIgnoreLengths[i] == null)</span>
<span class="nc" id="L241"> ? null : Integer.parseInt(queryMaximumIgnoreLengths[i]);</span>
<span class="nc" id="L242"> MtasSpanQuery q = MtasSolrResultUtil.constructQuery(queryValues[i],</span>
queryTypes[i], queryPrefixes[i], queryVariables[i], fields[i],
queryIgnores[i], maximumIgnoreLength);
// minimize number of queries
<span class="nc bnc" id="L246" title="All 2 branches missed."> if (cf.spanQueryList.contains(q)) {</span>
<span class="nc" id="L247"> q = cf.spanQueryList.get(cf.spanQueryList.indexOf(q));</span>
} else {
<span class="nc" id="L249"> cf.spanQueryList.add(q);</span>
}
<span class="nc bnc" id="L251" title="All 4 branches missed."> String key = (keys[i] == null) || (keys[i].isEmpty())</span>
<span class="nc" id="L252"> ? String.valueOf(i) + ":" + fields[i] + ":" + queryValues[i] + ":"</span>
+ queryPrefixes[i]
<span class="nc" id="L254"> : keys[i].trim();</span>
<span class="nc" id="L255"> String prefix = prefixes[i];</span>
<span class="nc bnc" id="L256" title="All 4 branches missed."> int start = (starts[i] == null) || (starts[i].isEmpty()) ? 0</span>
<span class="nc" id="L257"> : Integer.parseInt(starts[i]);</span>
<span class="nc bnc" id="L258" title="All 4 branches missed."> int number = (numbers[i] == null) || (numbers[i].isEmpty()) ? 10</span>
<span class="nc" id="L259"> : Integer.parseInt(numbers[i]);</span>
<span class="nc bnc" id="L260" title="All 4 branches missed."> int left = (lefts[i] == null) || lefts[i].isEmpty() ? 0</span>
<span class="nc" id="L261"> : Integer.parseInt(lefts[i]);</span>
<span class="nc bnc" id="L262" title="All 4 branches missed."> int right = (rights[i] == null) || rights[i].isEmpty() ? 0</span>
<span class="nc" id="L263"> : Integer.parseInt(rights[i]);</span>
<span class="nc" id="L264"> String output = outputs[i];</span>
<span class="nc" id="L265"> mtasFields.list.get(fields[i]).listList.add(new ComponentList(q,</span>
fields[i], queryValues[i], queryTypes[i], queryPrefixes[i],
queryVariables[i], queryIgnores[i], queryMaximumIgnoreLengths[i],
key, prefix, start, number, left, right, output));
}
}
<span class="nc" id="L271"> }</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="L284" title="All 2 branches missed."> if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)</span>
<span class="nc bnc" id="L285" title="All 2 branches missed."> && sreq.params.getBool(PARAM_MTAS_LIST, false)) {</span>
// compute keys
<span class="nc" id="L287"> Set<String> keys = MtasSolrResultUtil</span>
<span class="nc" id="L288"> .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_LIST);</span>
<span class="nc bnc" id="L289" title="All 2 branches missed."> if ((sreq.purpose & ShardRequest.PURPOSE_GET_TOP_IDS) != 0) {</span>
<span class="nc bnc" id="L290" title="All 2 branches missed."> for (String key : keys) {</span>
<span class="nc" id="L291"> sreq.params.remove(</span>
PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_PREFIX);
<span class="nc" id="L293"> sreq.params</span>
<span class="nc" id="L294"> .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_START);</span>
<span class="nc" id="L295"> sreq.params.remove(</span>
PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_NUMBER);
<span class="nc" id="L297"> sreq.params</span>
<span class="nc" id="L298"> .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_LEFT);</span>
<span class="nc" id="L299"> sreq.params</span>
<span class="nc" id="L300"> .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_RIGHT);</span>
<span class="nc" id="L301"> sreq.params.remove(</span>
PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_OUTPUT);
// don't get data
<span class="nc" id="L304"> sreq.params.add(</span>
PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_NUMBER, "0");
<span class="nc" id="L306"> }</span>
} else {
<span class="nc" id="L308"> sreq.params.remove(PARAM_MTAS_LIST);</span>
<span class="nc bnc" id="L309" title="All 2 branches missed."> for (String key : keys) {</span>
<span class="nc" id="L310"> sreq.params</span>
<span class="nc" id="L311"> .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_FIELD);</span>
<span class="nc" id="L312"> sreq.params.remove(</span>
PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_QUERY_VALUE);
<span class="nc" id="L314"> sreq.params.remove(</span>
PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_QUERY_TYPE);
<span class="nc" id="L316"> sreq.params.remove(</span>
PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_QUERY_PREFIX);
<span class="nc" id="L318"> sreq.params.remove(</span>
PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_QUERY_IGNORE);
<span class="nc" id="L320"> sreq.params.remove(PARAM_MTAS_LIST + "." + key + "."</span>
+ NAME_MTAS_LIST_QUERY_MAXIMUM_IGNORE_LENGTH);
<span class="nc" id="L322"> Set<String> subKeys = MtasSolrResultUtil</span>
<span class="nc" id="L323"> .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_LIST + "."</span>
+ key + "." + NAME_MTAS_LIST_QUERY_VARIABLE);
<span class="nc bnc" id="L325" title="All 2 branches missed."> for (String subKey : subKeys) {</span>
<span class="nc" id="L326"> sreq.params.remove(PARAM_MTAS_LIST + "." + key + "."</span>
+ NAME_MTAS_LIST_QUERY_VARIABLE + "." + subKey + "."
+ SUBNAME_MTAS_LIST_QUERY_VARIABLE_NAME);
<span class="nc" id="L329"> sreq.params.remove(PARAM_MTAS_LIST + "." + key + "."</span>
+ NAME_MTAS_LIST_QUERY_VARIABLE + "." + subKey + "."
+ SUBNAME_MTAS_LIST_QUERY_VARIABLE_VALUE);
<span class="nc" id="L332"> }</span>
<span class="nc" id="L333"> sreq.params</span>
<span class="nc" id="L334"> .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_KEY);</span>
<span class="nc" id="L335"> sreq.params.remove(</span>
PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_PREFIX);
<span class="nc" id="L337"> sreq.params</span>
<span class="nc" id="L338"> .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_START);</span>
<span class="nc" id="L339"> sreq.params.remove(</span>
PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_NUMBER);
<span class="nc" id="L341"> sreq.params</span>
<span class="nc" id="L342"> .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_LEFT);</span>
<span class="nc" id="L343"> sreq.params</span>
<span class="nc" id="L344"> .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_RIGHT);</span>
<span class="nc" id="L345"> sreq.params.remove(</span>
PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_OUTPUT);
<span class="nc" id="L347"> }</span>
}
}
<span class="nc" id="L350"> }</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) {
<span class="nc bnc" id="L364" title="All 2 branches missed."> if (mtasFields.doList) {</span>
// compute total from shards
<span class="nc" id="L366"> HashMap<String, HashMap<String, Integer>> listShardTotals = new HashMap<>();</span>
<span class="nc bnc" id="L367" title="All 2 branches missed."> for (ShardRequest sreq : rb.finished) {</span>
<span class="nc bnc" id="L368" title="All 2 branches missed."> if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)</span>
<span class="nc bnc" id="L369" title="All 2 branches missed."> && sreq.params.getBool(PARAM_MTAS_LIST, false)) {</span>
<span class="nc bnc" id="L370" title="All 2 branches missed."> for (ShardResponse response : sreq.responses) {</span>
<span class="nc" id="L371"> NamedList<Object> result = response.getSolrResponse().getResponse();</span>
try {
<span class="nc" id="L373"> ArrayList<NamedList<Object>> data = (ArrayList<NamedList<Object>>) result</span>
<span class="nc" id="L374"> .findRecursive("mtas", "list");</span>
<span class="nc bnc" id="L375" title="All 2 branches missed."> if (data != null) {</span>
<span class="nc bnc" id="L376" title="All 2 branches missed."> for (NamedList<Object> dataItem : data) {</span>
<span class="nc" id="L377"> Object key = dataItem.get("key");</span>
<span class="nc" id="L378"> Object total = dataItem.get("total");</span>
<span class="nc bnc" id="L379" title="All 8 branches missed."> if ((key != null) && (key instanceof String)</span>
&& (total != null) && (total instanceof Integer)) {
<span class="nc bnc" id="L381" title="All 2 branches missed."> if (!listShardTotals.containsKey(key)) {</span>
<span class="nc" id="L382"> listShardTotals.put((String) key,</span>
new HashMap<String, Integer>());
}
<span class="nc" id="L385"> HashMap<String, Integer> listShardTotal = listShardTotals</span>
<span class="nc" id="L386"> .get(key);</span>
<span class="nc" id="L387"> listShardTotal.put(response.getShard(), (Integer) total);</span>
}
<span class="nc" id="L389"> }</span>
}
<span class="nc" id="L391"> } catch (ClassCastException e) {</span>
<span class="nc" id="L392"> log.debug(e);</span>
<span class="nc" id="L393"> }</span>
<span class="nc" id="L394"> }</span>
}
<span class="nc" id="L396"> }</span>
// compute shard requests
<span class="nc" id="L398"> HashMap<String, ModifiableSolrParams> shardRequests = new HashMap<>();</span>
<span class="nc" id="L399"> int requestId = 0;</span>
<span class="nc bnc" id="L400" title="All 2 branches missed."> for (String field : mtasFields.list.keySet()) {</span>
<span class="nc bnc" id="L401" title="All 2 branches missed."> for (ComponentList list : mtasFields.list.get(field).listList) {</span>
<span class="nc" id="L402"> requestId++;</span>
<span class="nc bnc" id="L403" title="All 4 branches missed."> if (listShardTotals.containsKey(list.key) && (list.number > 0)) {</span>
<span class="nc" id="L404"> Integer start = list.start;</span>
<span class="nc" id="L405"> Integer number = list.number;</span>
<span class="nc" id="L406"> HashMap<String, Integer> totals = listShardTotals.get(list.key);</span>
<span class="nc bnc" id="L407" title="All 2 branches missed."> for (int i = 0; i < rb.shards.length; i++) {</span>
<span class="nc bnc" id="L408" title="All 2 branches missed."> if (number < 0) {</span>
<span class="nc" id="L409"> break;</span>
}
<span class="nc" id="L411"> int subTotal = totals.get(rb.shards[i]);</span>
// System.out.println(i + " : " + rb.shards[i] + " : "
// + totals.get(rb.shards[i]) + " - " + start + " " + number);
<span class="nc bnc" id="L414" title="All 4 branches missed."> if ((start >= 0) && (start < subTotal)) {</span>
ModifiableSolrParams params;
<span class="nc bnc" id="L416" title="All 2 branches missed."> if (!shardRequests.containsKey(rb.shards[i])) {</span>
<span class="nc" id="L417"> shardRequests.put(rb.shards[i], new ModifiableSolrParams());</span>
}
<span class="nc" id="L419"> params = shardRequests.get(rb.shards[i]);</span>
<span class="nc" id="L420"> params.add(PARAM_MTAS_LIST + "." + requestId + "."</span>
+ NAME_MTAS_LIST_FIELD, list.field);
<span class="nc" id="L422"> params.add(PARAM_MTAS_LIST + "." + requestId + "."</span>
+ NAME_MTAS_LIST_QUERY_VALUE, list.queryValue);
<span class="nc" id="L424"> params.add(PARAM_MTAS_LIST + "." + requestId + "."</span>
+ NAME_MTAS_LIST_QUERY_TYPE, list.queryType);
<span class="nc" id="L426"> params.add(PARAM_MTAS_LIST + "." + requestId + "."</span>
+ NAME_MTAS_LIST_QUERY_PREFIX, list.queryPrefix);
<span class="nc" id="L428"> params.add(PARAM_MTAS_LIST + "." + requestId + "."</span>
+ NAME_MTAS_LIST_QUERY_IGNORE, list.queryIgnore);
<span class="nc" id="L430"> params.add(</span>
PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_MAXIMUM_IGNORE_LENGTH,
list.queryMaximumIgnoreLength);
<span class="nc" id="L434"> int subRequestId = 0;</span>
<span class="nc bnc" id="L435" title="All 2 branches missed."> for (String name : list.queryVariables.keySet()) {</span>
<span class="nc bnc" id="L436" title="All 2 branches missed."> if (list.queryVariables.get(name) == null</span>
<span class="nc bnc" id="L437" title="All 2 branches missed."> || list.queryVariables.get(name).length == 0) {</span>
<span class="nc" id="L438"> params.add(</span>
PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_VARIABLE + "." + subRequestId
+ "." + SUBNAME_MTAS_LIST_QUERY_VARIABLE_NAME,
name);
<span class="nc" id="L443"> subRequestId++;</span>
} else {
<span class="nc bnc" id="L445" title="All 2 branches missed."> for (String value : list.queryVariables.get(name)) {</span>
<span class="nc" id="L446"> params.add(PARAM_MTAS_LIST + "." + requestId + "."</span>
+ NAME_MTAS_LIST_QUERY_VARIABLE + "." + subRequestId
+ "." + SUBNAME_MTAS_LIST_QUERY_VARIABLE_NAME, name);
<span class="nc" id="L449"> params.add(PARAM_MTAS_LIST + "." + requestId + "."</span>
+ NAME_MTAS_LIST_QUERY_VARIABLE + "." + subRequestId
+ "." + SUBNAME_MTAS_LIST_QUERY_VARIABLE_VALUE,
value);
<span class="nc" id="L453"> subRequestId++;</span>
}
}
<span class="nc" id="L456"> }</span>
<span class="nc" id="L457"> params.add(PARAM_MTAS_LIST + "." + requestId + "."</span>
+ NAME_MTAS_LIST_KEY, list.key);
<span class="nc" id="L459"> params.add(PARAM_MTAS_LIST + "." + requestId + "."</span>
+ NAME_MTAS_LIST_PREFIX, list.prefix);
<span class="nc" id="L461"> params.add(PARAM_MTAS_LIST + "." + requestId + "."</span>
<span class="nc" id="L462"> + NAME_MTAS_LIST_START, Integer.toString(start));</span>
<span class="nc" id="L463"> params.add(</span>
PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_NUMBER,
<span class="nc" id="L466"> Integer.toString(Math.min(number, (subTotal - start))));</span>
<span class="nc" id="L467"> params.add(PARAM_MTAS_LIST + "." + requestId + "."</span>
<span class="nc" id="L468"> + NAME_MTAS_LIST_LEFT, Integer.toString(list.left));</span>
<span class="nc" id="L469"> params.add(PARAM_MTAS_LIST + "." + requestId + "."</span>
<span class="nc" id="L470"> + NAME_MTAS_LIST_RIGHT, Integer.toString(list.right));</span>
<span class="nc" id="L471"> params.add(PARAM_MTAS_LIST + "." + requestId + "."</span>
+ NAME_MTAS_LIST_OUTPUT, list.output);
<span class="nc" id="L473"> number -= (subTotal - start);</span>
<span class="nc" id="L474"> start = 0;</span>
<span class="nc" id="L475"> } else {</span>
<span class="nc" id="L476"> start -= subTotal;</span>
}
}
}
<span class="nc" id="L480"> }</span>
<span class="nc" id="L481"> }</span>
<span class="nc bnc" id="L483" title="All 2 branches missed."> for (Entry<String, ModifiableSolrParams> entry : shardRequests</span>
<span class="nc" id="L484"> .entrySet()) {</span>
<span class="nc" id="L485"> ShardRequest sreq = new ShardRequest();</span>
<span class="nc" id="L486"> sreq.shards = new String[] { entry.getKey() };</span>
<span class="nc" id="L487"> sreq.purpose = ShardRequest.PURPOSE_PRIVATE;</span>
<span class="nc" id="L488"> sreq.params = new ModifiableSolrParams();</span>
<span class="nc" id="L489"> sreq.params.add("fq", rb.req.getParams().getParams("fq"));</span>
<span class="nc" id="L490"> sreq.params.add("q", rb.req.getParams().getParams("q"));</span>
<span class="nc" id="L491"> sreq.params.add("cache", rb.req.getParams().getParams("cache"));</span>
<span class="nc" id="L492"> sreq.params.add("rows", "0");</span>
<span class="nc" id="L493"> sreq.params.add(MtasSolrSearchComponent.PARAM_MTAS, rb.req</span>
<span class="nc" id="L494"> .getOriginalParams().getParams(MtasSolrSearchComponent.PARAM_MTAS));</span>
<span class="nc" id="L495"> sreq.params.add(PARAM_MTAS_LIST,</span>
<span class="nc" id="L496"> rb.req.getOriginalParams().getParams(PARAM_MTAS_LIST));</span>
<span class="nc" id="L497"> sreq.params.add(entry.getValue());</span>
<span class="nc" id="L498"> rb.addRequest(searchComponent, sreq);</span>
<span class="nc" id="L499"> }</span>
}
<span class="nc" id="L501"> }</span>
/*
* (non-Javadoc)
*
* @see
* mtas.solr.handler.component.util.MtasSolrComponent#create(mtas.codec.util.
* CodecComponent.BasicComponent, java.lang.Boolean)
*/
public SimpleOrderedMap<Object> create(ComponentList list, Boolean encode) {
<span class="nc" id="L511"> SimpleOrderedMap<Object> mtasListResponse = new SimpleOrderedMap<>();</span>
<span class="nc" id="L512"> mtasListResponse.add("key", list.key);</span>
<span class="nc bnc" id="L513" title="All 2 branches missed."> if (list.number == 0) {</span>
<span class="nc" id="L514"> mtasListResponse.add("total", list.total);</span>
}
<span class="nc bnc" id="L516" title="All 2 branches missed."> if (list.output != null) {</span>
<span class="nc" id="L517"> ArrayList<NamedList<Object>> mtasListItemResponses = new ArrayList<>();</span>
<span class="nc bnc" id="L518" title="All 2 branches missed."> if (list.output.equals(ComponentList.LIST_OUTPUT_HIT)) {</span>
<span class="nc" id="L519"> mtasListResponse.add("number", list.hits.size());</span>
<span class="nc bnc" id="L520" title="All 2 branches missed."> for (ListHit hit : list.hits) {</span>
<span class="nc" id="L521"> NamedList<Object> mtasListItemResponse = new SimpleOrderedMap<>();</span>
<span class="nc" id="L522"> mtasListItemResponse.add("documentKey",</span>
<span class="nc" id="L523"> list.uniqueKey.get(hit.docId));</span>
<span class="nc" id="L524"> mtasListItemResponse.add("documentHitPosition", hit.docPosition);</span>
<span class="nc" id="L525"> mtasListItemResponse.add("documentHitTotal",</span>
<span class="nc" id="L526"> list.subTotal.get(hit.docId));</span>
<span class="nc" id="L527"> mtasListItemResponse.add("documentMinPosition",</span>
<span class="nc" id="L528"> list.minPosition.get(hit.docId));</span>
<span class="nc" id="L529"> mtasListItemResponse.add("documentMaxPosition",</span>
<span class="nc" id="L530"> list.maxPosition.get(hit.docId));</span>
<span class="nc" id="L531"> mtasListItemResponse.add("startPosition", hit.startPosition);</span>
<span class="nc" id="L532"> mtasListItemResponse.add("endPosition", hit.endPosition);</span>
<span class="nc" id="L534"> SortedMap<Integer, List<List<String>>> hitData = new TreeMap<>();</span>
<span class="nc" id="L535"> SortedMap<Integer, List<List<String>>> leftData = null;</span>
<span class="nc" id="L536"> SortedMap<Integer, List<List<String>>> rightData = null;</span>
<span class="nc bnc" id="L537" title="All 2 branches missed."> if (list.left > 0) {</span>
<span class="nc" id="L538"> leftData = new TreeMap<>();</span>
}
<span class="nc bnc" id="L540" title="All 2 branches missed."> if (list.right > 0) {</span>
<span class="nc" id="L541"> rightData = new TreeMap<>();</span>
}
<span class="nc" id="L543"> for (int position = Math.max(0,</span>
<span class="nc bnc" id="L544" title="All 2 branches missed."> hit.startPosition - list.left); position <= (hit.endPosition</span>
<span class="nc" id="L545"> + list.right); position++) {</span>
<span class="nc" id="L546"> List<List<String>> hitDataItem = new ArrayList<>();</span>
<span class="nc bnc" id="L547" title="All 2 branches missed."> if (hit.hits.containsKey(position)) {</span>
<span class="nc bnc" id="L548" title="All 2 branches missed."> for (String term : hit.hits.get(position)) {</span>
<span class="nc" id="L549"> List<String> hitDataSubItem = new ArrayList<>();</span>
<span class="nc" id="L550"> hitDataSubItem.add(CodecUtil.termPrefix(term));</span>
<span class="nc" id="L551"> hitDataSubItem.add(CodecUtil.termValue(term));</span>
<span class="nc" id="L552"> hitDataItem.add(hitDataSubItem);</span>
<span class="nc" id="L553"> }</span>
}
<span class="nc bnc" id="L555" title="All 2 branches missed."> if (position < hit.startPosition) {</span>
<span class="nc bnc" id="L556" title="All 2 branches missed."> if (leftData != null) {</span>
<span class="nc" id="L557"> leftData.put(position, hitDataItem);</span>
}
<span class="nc bnc" id="L559" title="All 2 branches missed."> } else if (position > hit.endPosition) {</span>
<span class="nc bnc" id="L560" title="All 2 branches missed."> if (rightData != null) {</span>
<span class="nc" id="L561"> rightData.put(position, hitDataItem);</span>
}
} else {
<span class="nc" id="L564"> hitData.put(position, hitDataItem);</span>
}
}
<span class="nc bnc" id="L567" title="All 2 branches missed."> if (list.left > 0) {</span>
<span class="nc" id="L568"> mtasListItemResponse.add("left", leftData);</span>
}
<span class="nc" id="L570"> mtasListItemResponse.add("hit", hitData);</span>
<span class="nc bnc" id="L571" title="All 2 branches missed."> if (list.right > 0) {</span>
<span class="nc" id="L572"> mtasListItemResponse.add("right", rightData);</span>
}
<span class="nc" id="L574"> mtasListItemResponses.add(mtasListItemResponse);</span>
<span class="nc" id="L575"> }</span>
<span class="nc bnc" id="L576" title="All 2 branches missed."> } else if (list.output.equals(ComponentList.LIST_OUTPUT_TOKEN)) {</span>
<span class="nc" id="L577"> mtasListResponse.add("number", list.tokens.size());</span>
<span class="nc bnc" id="L578" title="All 2 branches missed."> for (ListToken tokenHit : list.tokens) {</span>
<span class="nc" id="L579"> NamedList<Object> mtasListItemResponse = new SimpleOrderedMap<>();</span>
<span class="nc" id="L580"> mtasListItemResponse.add("documentKey",</span>
<span class="nc" id="L581"> list.uniqueKey.get(tokenHit.docId));</span>
<span class="nc" id="L582"> mtasListItemResponse.add("documentHitPosition", tokenHit.docPosition);</span>
<span class="nc" id="L583"> mtasListItemResponse.add("documentHitTotal",</span>
<span class="nc" id="L584"> list.subTotal.get(tokenHit.docId));</span>
<span class="nc" id="L585"> mtasListItemResponse.add("documentMinPosition",</span>
<span class="nc" id="L586"> list.minPosition.get(tokenHit.docId));</span>
<span class="nc" id="L587"> mtasListItemResponse.add("documentMaxPosition",</span>
<span class="nc" id="L588"> list.maxPosition.get(tokenHit.docId));</span>
<span class="nc" id="L589"> mtasListItemResponse.add("startPosition", tokenHit.startPosition);</span>
<span class="nc" id="L590"> mtasListItemResponse.add("endPosition", tokenHit.endPosition);</span>
<span class="nc" id="L592"> ArrayList<NamedList<Object>> mtasListItemResponseItemTokens = new ArrayList<>();</span>
<span class="nc bnc" id="L593" title="All 2 branches missed."> for (MtasToken token : tokenHit.tokens) {</span>
<span class="nc" id="L594"> NamedList<Object> mtasListItemResponseItemToken = new SimpleOrderedMap<>();</span>
<span class="nc bnc" id="L595" title="All 2 branches missed."> if (token.getId() != null) {</span>
<span class="nc" id="L596"> mtasListItemResponseItemToken.add("mtasId", token.getId());</span>
}
<span class="nc" id="L598"> mtasListItemResponseItemToken.add("prefix", token.getPrefix());</span>
<span class="nc" id="L599"> mtasListItemResponseItemToken.add("value", token.getPostfix());</span>
<span class="nc bnc" id="L600" title="All 2 branches missed."> if (token.getPositionStart() != null) {</span>
<span class="nc" id="L601"> mtasListItemResponseItemToken.add("positionStart",</span>
<span class="nc" id="L602"> token.getPositionStart());</span>
<span class="nc" id="L603"> mtasListItemResponseItemToken.add("positionEnd",</span>
<span class="nc" id="L604"> token.getPositionEnd());</span>
}
<span class="nc bnc" id="L606" title="All 2 branches missed."> if (token.getPositions() != null) {</span>
<span class="nc" id="L607"> mtasListItemResponseItemToken.add("positions",</span>
<span class="nc" id="L608"> token.getPositions());</span>
}
<span class="nc bnc" id="L610" title="All 2 branches missed."> if (token.getParentId() != null) {</span>
<span class="nc" id="L611"> mtasListItemResponseItemToken.add("parentMtasId",</span>
<span class="nc" id="L612"> token.getParentId());</span>
}
<span class="nc bnc" id="L614" title="All 2 branches missed."> if (token.getPayload() != null) {</span>
<span class="nc" id="L615"> mtasListItemResponseItemToken.add("payload", token.getPayload());</span>
}
<span class="nc bnc" id="L617" title="All 2 branches missed."> if (token.getOffsetStart() != null) {</span>
<span class="nc" id="L618"> mtasListItemResponseItemToken.add("offsetStart",</span>
<span class="nc" id="L619"> token.getOffsetStart());</span>
<span class="nc" id="L620"> mtasListItemResponseItemToken.add("offsetEnd",</span>
<span class="nc" id="L621"> token.getOffsetEnd());</span>
}
<span class="nc bnc" id="L623" title="All 2 branches missed."> if (token.getRealOffsetStart() != null) {</span>
<span class="nc" id="L624"> mtasListItemResponseItemToken.add("realOffsetStart",</span>
<span class="nc" id="L625"> token.getRealOffsetStart());</span>
<span class="nc" id="L626"> mtasListItemResponseItemToken.add("realOffsetEnd",</span>
<span class="nc" id="L627"> token.getRealOffsetEnd());</span>
}
<span class="nc" id="L629"> mtasListItemResponseItemTokens.add(mtasListItemResponseItemToken);</span>
<span class="nc" id="L630"> }</span>
<span class="nc" id="L631"> mtasListItemResponse.add("tokens", mtasListItemResponseItemTokens);</span>
<span class="nc" id="L632"> mtasListItemResponses.add(mtasListItemResponse);</span>
<span class="nc" id="L633"> }</span>
}
<span class="nc" id="L635"> mtasListResponse.add("list", mtasListItemResponses);</span>
}
<span class="nc" id="L637"> return mtasListResponse;</span>
}
/*
* (non-Javadoc)
*
* @see
* mtas.solr.handler.component.util.MtasSolrComponent#finishStage(org.apache.
* solr.handler.component.ResponseBuilder)
*/
public void finishStage(ResponseBuilder rb) {
<span class="nc bnc" id="L648" 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="L651" title="All 2 branches missed."> for (ShardRequest sreq : rb.finished) {</span>
<span class="nc bnc" id="L652" title="All 2 branches missed."> if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)</span>
<span class="nc bnc" id="L653" title="All 2 branches missed."> && sreq.params.getBool(PARAM_MTAS_LIST, false)) {</span>
// nothing to do
}
<span class="nc" id="L656"> }</span>
}
<span class="nc" id="L658"> }</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>