MtasSolrResultUtil.java.html
25 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
<?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>MtasSolrResultUtil.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">MtasSolrResultUtil.java</span></div><h1>MtasSolrResultUtil.java</h1><pre class="source lang-java linenums">package mtas.solr.handler.component.util;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.Base64;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import mtas.codec.util.DataCollector;
import mtas.codec.util.CodecComponent.GroupHit;
import mtas.codec.util.collector.MtasDataItem;
import mtas.parser.cql.MtasCQLParser;
import mtas.parser.cql.TokenMgrError;
import mtas.search.spans.util.MtasSpanQuery;
/**
* The Class MtasSolrResultUtil.
*/
public class MtasSolrResultUtil {
/** The Constant log. */
<span class="fc" id="L42"> private static final Log log = LogFactory.getLog(MtasSolrResultUtil.class);</span>
/** The Constant QUERY_TYPE_CQL. */
public static final String QUERY_TYPE_CQL = "cql";
/** The Constant patternKeyStartGrouphit. */
<span class="fc" id="L48"> public static final Pattern patternKeyStartGrouphit = Pattern</span>
<span class="fc" id="L49"> .compile("^" + GroupHit.KEY_START);</span>
/**
* Instantiates a new mtas solr result util.
*/
<span class="nc" id="L54"> private MtasSolrResultUtil() {</span>
// do nothing
<span class="nc" id="L56"> }</span>
/**
* Rewrite.
*
* @param al the al
* @throws IOException Signals that an I/O exception has occurred.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void rewrite(ArrayList<?> al) throws IOException {
<span class="fc bfc" id="L66" title="All 2 branches covered."> for (int i = 0; i < al.size(); i++) {</span>
<span class="pc bpc" id="L67" title="1 of 2 branches missed."> if (al.get(i) instanceof NamedList) {</span>
<span class="fc" id="L68"> rewrite((NamedList) al.get(i));</span>
<span class="nc bnc" id="L69" title="All 2 branches missed."> } else if (al.get(i) instanceof ArrayList) {</span>
<span class="nc" id="L70"> rewrite((ArrayList) al.get(i));</span>
}
}
<span class="fc" id="L73"> }</span>
/**
* Rewrite.
*
* @param nl the nl
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void rewrite(NamedList<Object> nl) throws IOException {
<span class="fc" id="L82"> rewrite(nl, true); </span>
<span class="fc" id="L83"> }</span>
/**
* Rewrite.
*
* @param nl the nl
* @param doCollapse the do collapse
* @throws IOException Signals that an I/O exception has occurred.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private static void rewrite(NamedList<Object> nl, boolean doCollapse)
throws IOException {
<span class="fc" id="L95"> boolean showDebugInfo = false;</span>
<span class="fc" id="L96"> HashMap<String, NamedList<Object>> collapseNamedList = new HashMap<String, NamedList<Object>>();</span>
<span class="fc" id="L97"> int length = nl.size();</span>
<span class="fc bfc" id="L98" title="All 2 branches covered."> for (int i = 0; i < length; i++) {</span>
<span class="pc bpc" id="L99" title="1 of 2 branches missed."> if (nl.getVal(i) instanceof NamedList) {</span>
<span class="nc" id="L100"> NamedList o = (NamedList) nl.getVal(i);</span>
<span class="nc" id="L101"> rewrite(o, true);</span>
<span class="nc" id="L102"> nl.setVal(i, o);</span>
<span class="pc bfc" id="L103" title="All 2 branches covered."> } else if (nl.getVal(i) instanceof ArrayList) {</span>
<span class="fc" id="L104"> ArrayList o = (ArrayList) nl.getVal(i);</span>
<span class="fc" id="L105"> rewrite(o);</span>
<span class="fc" id="L106"> nl.setVal(i, o);</span>
<span class="pc bpc" id="L107" title="1 of 2 branches missed."> } else if (nl.getVal(i) instanceof MtasDataItem) {</span>
<span class="nc" id="L108"> MtasDataItem dataItem = (MtasDataItem) nl.getVal(i);</span>
<span class="nc" id="L109"> nl.setVal(i, dataItem.rewrite(showDebugInfo));</span>
<span class="pc bfc" id="L110" title="All 2 branches covered."> } else if (nl.getVal(i) instanceof MtasSolrMtasResult) {</span>
<span class="fc" id="L111"> MtasSolrMtasResult o = (MtasSolrMtasResult) nl.getVal(i);</span>
<span class="fc" id="L112"> if (o.dataCollector.getCollectorType()</span>
<span class="fc bfc" id="L113" title="All 2 branches covered."> .equals(DataCollector.COLLECTOR_TYPE_LIST)) {</span>
<span class="fc bfc" id="L114" title="All 2 branches covered."> if (!o.dataCollector.withTotal()) {</span>
<span class="fc" id="L115"> NamedList<Object> nnl = o.getNamedList(showDebugInfo);</span>
<span class="fc bfc" id="L116" title="All 2 branches covered."> for (int j = 0; j < nnl.size(); j++) {</span>
<span class="pc bpc" id="L117" title="1 of 2 branches missed."> if (nnl.getVal(j) != null</span>
<span class="pc bpc" id="L118" title="1 of 2 branches missed."> && nnl.getVal(j) instanceof MtasDataItem) {</span>
<span class="nc" id="L119"> MtasDataItem mdi = (MtasDataItem) nnl.getVal(j);</span>
<span class="nc" id="L120"> mdi.rewrite(showDebugInfo);</span>
<span class="nc" id="L121"> nnl.setVal(j, mdi);</span>
}
}
//System.out.println("rewrite -- "+nnl);
<span class="fc" id="L125"> nl.setVal(i, rewriteToArray(nnl));</span>
//System.out.println("rewrite! "+nl.getVal(i));
<span class="fc" id="L127"> } else {</span>
<span class="fc" id="L128"> NamedList<Object> tmpResponse = new SimpleOrderedMap<>();</span>
<span class="fc" id="L129"> tmpResponse.add(nl.getName(i) + "Total", o.dataCollector.getSize());</span>
<span class="fc" id="L130"> NamedList<Object> nnl = o.getNamedList(showDebugInfo);</span>
<span class="fc bfc" id="L131" title="All 2 branches covered."> for (int j = 0; j < nnl.size(); j++) {</span>
<span class="pc bpc" id="L132" title="1 of 2 branches missed."> if (nnl.getVal(j) != null</span>
<span class="pc bpc" id="L133" title="1 of 2 branches missed."> && nnl.getVal(j) instanceof MtasDataItem) {</span>
<span class="nc" id="L134"> MtasDataItem mdi = (MtasDataItem) nnl.getVal(j);</span>
<span class="nc" id="L135"> mdi.rewrite(showDebugInfo);</span>
<span class="nc" id="L136"> nnl.setVal(j, mdi);</span>
}
}
<span class="fc" id="L139"> tmpResponse.add(nl.getName(i), rewriteToArray(nnl));</span>
<span class="fc" id="L140"> nl.setVal(i, null);</span>
<span class="fc" id="L141"> collapseNamedList.put(nl.getName(i), tmpResponse);</span>
<span class="fc" id="L142"> }</span>
<span class="fc" id="L143"> } else if (o.dataCollector.getCollectorType()</span>
<span class="pc bpc" id="L144" title="1 of 2 branches missed."> .equals(DataCollector.COLLECTOR_TYPE_DATA)) {</span>
<span class="fc" id="L145"> NamedList<Object> nnl = o.getData(showDebugInfo);</span>
<span class="fc bfc" id="L146" title="All 2 branches covered."> if (nnl.size() > 0) {</span>
<span class="fc" id="L147"> rewrite(nnl);</span>
<span class="fc" id="L148"> collapseNamedList.put(nl.getName(i), nnl);</span>
<span class="fc" id="L149"> nl.setVal(i, nnl);</span>
} else {
<span class="fc" id="L151"> nl.setVal(i, null);</span>
}
}
}
}
// collapse
<span class="pc bpc" id="L157" title="1 of 4 branches missed."> if (doCollapse && collapseNamedList.size() > 0) {</span>
<span class="fc bfc" id="L158" title="All 2 branches covered."> for (String key : collapseNamedList.keySet()) {</span>
<span class="fc" id="L159"> nl.remove(key);</span>
<span class="fc" id="L160"> }</span>
<span class="fc bfc" id="L161" title="All 2 branches covered."> for (NamedList<Object> items : collapseNamedList.values()) {</span>
<span class="fc" id="L162"> nl.addAll(items);</span>
<span class="fc" id="L163"> }</span>
}
<span class="fc" id="L165"> }</span>
/**
* Rewrite to array.
*
* @param nnl the nnl
* @return the array list
*/
private static ArrayList<NamedList<Object>> rewriteToArray(
NamedList<Object> nnl) {
<span class="fc" id="L175"> ArrayList<NamedList<Object>> al = new ArrayList<NamedList<Object>>();</span>
String key;
<span class="fc" id="L177"> Iterator<Entry<String, Object>> it = nnl.iterator();</span>
<span class="fc bfc" id="L178" title="All 2 branches covered."> while (it.hasNext()) {</span>
<span class="fc" id="L179"> Entry<String, Object> entry = it.next();</span>
<span class="fc" id="L180"> NamedList<Object> item = (NamedList<Object>) entry.getValue();</span>
<span class="fc" id="L181"> key = entry.getKey();</span>
<span class="pc bpc" id="L182" title="1 of 2 branches missed."> if (key.startsWith(GroupHit.KEY_START)) {</span>
<span class="nc" id="L183"> StringBuilder newKey = new StringBuilder("");</span>
<span class="nc" id="L184"> item.add("group", GroupHit.keyToObject(key, newKey));</span>
<span class="nc" id="L185"> item.add("key", newKey.toString().trim());</span>
<span class="nc" id="L186"> } else {</span>
<span class="fc" id="L187"> item.add("key", key);</span>
}
<span class="fc" id="L189"> al.add(item);</span>
<span class="fc" id="L190"> }</span>
<span class="fc" id="L191"> return al;</span>
}
/**
* Rewrite merge list.
*
* @param key the key
* @param subKey the sub key
* @param snl the snl
* @param tnl the tnl
*/
@SuppressWarnings({ "unchecked", "unused" })
private static void rewriteMergeList(String key, String subKey,
NamedList<Object> snl, NamedList<Object> tnl) {
<span class="nc bnc" id="L205" title="All 2 branches missed."> for (int i = 0; i < tnl.size(); i++) {</span>
<span class="nc" id="L206"> Object item = snl.get(tnl.getName(i));</span>
<span class="nc bnc" id="L207" title="All 4 branches missed."> if (item != null && tnl.getVal(i) instanceof NamedList) {</span>
<span class="nc" id="L208"> NamedList<Object> tnnl = (NamedList<Object>) tnl.getVal(i);</span>
<span class="nc" id="L209"> Object o = tnnl.get(key);</span>
NamedList<Object> tnnnl;
<span class="nc bnc" id="L211" title="All 4 branches missed."> if (o != null && o instanceof NamedList) {</span>
<span class="nc" id="L212"> tnnnl = (NamedList<Object>) o;</span>
} else {
<span class="nc" id="L214"> tnnnl = new SimpleOrderedMap<>();</span>
<span class="nc" id="L215"> tnnl.add(key, tnnnl);</span>
}
<span class="nc" id="L217"> tnnnl.add(subKey, item);</span>
}
}
<span class="nc" id="L220"> }</span>
/**
* Rewrite merge data.
*
* @param key the key
* @param subKey the sub key
* @param snl the snl
* @param tnl the tnl
*/
@SuppressWarnings({ "unused", "unchecked" })
private static void rewriteMergeData(String key, String subKey,
NamedList<Object> snl, NamedList<Object> tnl) {
<span class="nc bnc" id="L233" title="All 2 branches missed."> if (snl != null) {</span>
<span class="nc" id="L234"> Object o = tnl.get(key);</span>
NamedList<Object> tnnnl;
<span class="nc bnc" id="L236" title="All 4 branches missed."> if (o != null && o instanceof NamedList) {</span>
<span class="nc" id="L237"> tnnnl = (NamedList<Object>) o;</span>
} else {
<span class="nc" id="L239"> tnnnl = new SimpleOrderedMap<>();</span>
<span class="nc" id="L240"> tnl.add(key, tnnnl);</span>
}
<span class="nc" id="L242"> tnnnl.add(subKey, snl);</span>
}
<span class="nc" id="L244"> }</span>
/**
* Encode.
*
* @param o the o
* @return the string
*/
public static String encode(Object o) {
<span class="fc" id="L253"> ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();</span>
ObjectOutputStream objectOutputStream;
try {
<span class="fc" id="L256"> objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);</span>
<span class="fc" id="L257"> objectOutputStream.writeObject(o);</span>
<span class="fc" id="L258"> objectOutputStream.close();</span>
<span class="fc" id="L259"> byte[] byteArray = byteArrayOutputStream.toByteArray();</span>
<span class="fc" id="L260"> return Base64.byteArrayToBase64(byteArray);</span>
<span class="nc" id="L261"> } catch (IOException e) {</span>
<span class="nc" id="L262"> log.error(e);</span>
<span class="nc" id="L263"> return null;</span>
}
}
/**
* Decode.
*
* @param s the s
* @return the object
*/
static Object decode(String s) {
<span class="fc" id="L274"> byte[] bytes = Base64.base64ToByteArray(s);</span>
ObjectInputStream objectInputStream;
try {
<span class="fc" id="L277"> objectInputStream = new ObjectInputStream(</span>
new ByteArrayInputStream(bytes));
<span class="fc" id="L279"> return objectInputStream.readObject();</span>
<span class="nc" id="L280"> } catch (IOException | ClassNotFoundException e) {</span>
<span class="nc" id="L281"> log.error(e);</span>
<span class="nc" id="L282"> return null;</span>
}
}
/**
* Decode.
*
* @param l the l
* @return the array list
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
static ArrayList decode(ArrayList l) {
<span class="fc bfc" id="L294" title="All 2 branches covered."> for (int i = 0; i < l.size(); i++) {</span>
<span class="pc bpc" id="L295" title="1 of 2 branches missed."> if (l.get(i) instanceof NamedList) {</span>
<span class="fc" id="L296"> l.set(i, decode((NamedList) l.get(i)));</span>
<span class="nc bnc" id="L297" title="All 2 branches missed."> } else if (l.get(i) instanceof ArrayList) {</span>
<span class="nc" id="L298"> l.set(i, decode((ArrayList) l.get(i)));</span>
}
}
<span class="fc" id="L301"> return l;</span>
}
/**
* Decode.
*
* @param nl the nl
* @return the named list
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
static NamedList<Object> decode(NamedList<Object> nl) {
<span class="fc bfc" id="L312" title="All 2 branches covered."> for (int i = 0; i < nl.size(); i++) {</span>
<span class="fc" id="L313"> String key = nl.getName(i);</span>
<span class="fc" id="L314"> Object o = nl.getVal(i);</span>
<span class="fc bfc" id="L315" title="All 2 branches covered."> if (key.matches("^_encoded_.*$")) {</span>
<span class="pc bpc" id="L316" title="1 of 2 branches missed."> if (o instanceof String) {</span>
<span class="fc" id="L317"> Object decodedObject = decode((String) nl.getVal(i));</span>
<span class="fc" id="L318"> String decodedKey = key.replaceFirst("^_encoded_", "");</span>
<span class="pc bpc" id="L319" title="1 of 2 branches missed."> if (decodedKey.equals("")) {</span>
<span class="nc" id="L320"> decodedKey = "_" + decodedObject.getClass().getSimpleName() + "_";</span>
}
<span class="fc" id="L322"> nl.setName(i, decodedKey);</span>
<span class="fc" id="L323"> nl.setVal(i, decodedObject);</span>
<span class="pc bnc" id="L324" title="All 2 branches missed."> } else if (o instanceof NamedList) {</span>
<span class="nc" id="L325"> NamedList nl2 = (NamedList) o;</span>
<span class="nc bnc" id="L326" title="All 2 branches missed."> for (int j = 0; j < nl2.size(); j++) {</span>
<span class="nc bnc" id="L327" title="All 2 branches missed."> if (nl2.getVal(j) instanceof String) {</span>
<span class="nc" id="L328"> nl2.setVal(j, decode((String) nl2.getVal(j)));</span>
}
}
<span class="nc" id="L331"> } else {</span>
// System.out.println("unknown type " +
// o.getClass().getCanonicalName());
}
} else {
<span class="pc bpc" id="L336" title="1 of 2 branches missed."> if (o instanceof NamedList) {</span>
<span class="nc" id="L337"> nl.setVal(i, decode((NamedList<Object>) o));</span>
<span class="fc bfc" id="L338" title="All 2 branches covered."> } else if (o instanceof ArrayList) {</span>
<span class="fc" id="L339"> nl.setVal(i, decode((ArrayList<Object>) o));</span>
}
}
}
<span class="fc" id="L343"> return nl;</span>
}
/**
* Gets the ids from parameters.
*
* @param params the params
* @param prefix the prefix
* @return the ids from parameters
*/
public static SortedSet<String> getIdsFromParameters(SolrParams params,
String prefix) {
<span class="fc" id="L355"> SortedSet<String> ids = new TreeSet<>();</span>
<span class="fc" id="L356"> Iterator<String> it = params.getParameterNamesIterator();</span>
<span class="fc" id="L357"> Pattern pattern = Pattern</span>
<span class="fc" id="L358"> .compile("^" + Pattern.quote(prefix) + "\\.([^\\.]+)(\\..*|$)");</span>
<span class="fc bfc" id="L359" title="All 2 branches covered."> while (it.hasNext()) {</span>
<span class="fc" id="L360"> String item = it.next();</span>
<span class="fc" id="L361"> Matcher m = pattern.matcher(item);</span>
<span class="fc bfc" id="L362" title="All 2 branches covered."> if (m.matches()) {</span>
<span class="fc" id="L363"> ids.add(m.group(1));</span>
}
<span class="fc" id="L365"> }</span>
<span class="fc" id="L366"> return ids;</span>
}
/**
* Compare and check.
*
* @param list the list
* @param original the original
* @param nameNew the name new
* @param nameOriginal the name original
* @param unique the unique
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void compareAndCheck(String[] list, String[] original,
String nameNew, String nameOriginal, Boolean unique) throws IOException {
<span class="pc bpc" id="L381" title="1 of 2 branches missed."> if (list != null) {</span>
<span class="pc bpc" id="L382" title="1 of 2 branches missed."> if (list.length != original.length) {</span>
<span class="nc" id="L383"> throw new IOException(</span>
"unequal size " + nameNew + " and " + nameOriginal);
}
<span class="fc bfc" id="L386" title="All 2 branches covered."> if (unique) {</span>
<span class="fc" id="L387"> Set<String> set = new HashSet<String>();</span>
<span class="fc bfc" id="L388" title="All 2 branches covered."> for (int i = 0; i < list.length; i++) {</span>
<span class="fc" id="L389"> set.add(list[i]);</span>
}
<span class="pc bpc" id="L391" title="1 of 2 branches missed."> if (set.size() < list.length) {</span>
<span class="nc" id="L392"> throw new IOException("duplicate " + nameNew);</span>
}
}
}
<span class="fc" id="L396"> }</span>
/**
* Construct query.
*
* @param queryValue the query value
* @param queryType the query type
* @param queryPrefix the query prefix
* @param queryVariables the query variables
* @param field the field
* @param queryIgnore the query ignore
* @param maximumIgnoreLength the maximum ignore length
* @return the mtas span query
* @throws IOException Signals that an I/O exception has occurred.
*/
public static MtasSpanQuery constructQuery(String queryValue,
String queryType, String queryPrefix,
HashMap<String, String[]> queryVariables, String field,
String queryIgnore, Integer maximumIgnoreLength) throws IOException {
<span class="pc bpc" id="L415" title="2 of 4 branches missed."> if (queryType == null || queryType.isEmpty()) {</span>
<span class="nc" id="L416"> throw new IOException("no (valid) type for query " + queryValue);</span>
<span class="pc bpc" id="L417" title="2 of 4 branches missed."> } else if (queryValue == null || queryValue.isEmpty()) {</span>
<span class="nc" id="L418"> throw new IOException("no (valid) value for " + queryType + " query");</span>
}
<span class="fc" id="L420"> MtasSpanQuery ignore = null;</span>
<span class="pc bpc" id="L421" title="1 of 2 branches missed."> if (queryIgnore != null) {</span>
<span class="nc" id="L422"> Reader queryIgnoreReader = new BufferedReader(</span>
new StringReader(queryIgnore));
<span class="nc bnc" id="L424" title="All 2 branches missed."> if (queryType.equals(QUERY_TYPE_CQL)) {</span>
<span class="nc" id="L425"> MtasCQLParser ip = new MtasCQLParser(queryIgnoreReader);</span>
try {
<span class="nc" id="L427"> ignore = ip.parse(field, null, null, null, null);</span>
<span class="nc" id="L428"> } catch (mtas.parser.cql.ParseException e) { </span>
<span class="nc" id="L429"> throw new IOException("couldn't parse " + queryType + " query "</span>
<span class="nc" id="L430"> + queryIgnore + " (" + e.getMessage() + ")", e);</span>
<span class="nc" id="L431"> } catch (TokenMgrError e) {</span>
<span class="nc" id="L432"> throw new IOException("couldn't parse " + queryType + " query "</span>
<span class="nc" id="L433"> + queryIgnore + " (" + e.getMessage() + ")", e);</span>
<span class="nc" id="L434"> }</span>
<span class="nc" id="L435"> } else {</span>
<span class="nc" id="L436"> throw new IOException(</span>
"unknown queryType " + queryType + " for query " + queryValue);
}
}
<span class="fc" id="L440"> Reader queryValueReader = new BufferedReader(new StringReader(queryValue));</span>
<span class="pc bpc" id="L441" title="1 of 2 branches missed."> if (queryType.equals(QUERY_TYPE_CQL)) {</span>
<span class="fc" id="L442"> MtasCQLParser qp = new MtasCQLParser(queryValueReader);</span>
try {
<span class="fc" id="L444"> return qp.parse(field, queryPrefix, queryVariables, ignore,</span>
maximumIgnoreLength);
<span class="nc" id="L446"> } catch (mtas.parser.cql.ParseException e) {</span>
<span class="nc" id="L447"> throw new IOException("couldn't parse " + queryType + " query "</span>
<span class="nc" id="L448"> + queryValue + " (" + e.getMessage() + ")", e);</span>
<span class="nc" id="L449"> } catch (TokenMgrError e) {</span>
<span class="nc" id="L450"> throw new IOException("couldn't parse " + queryType + " query "</span>
<span class="nc" id="L451"> + queryValue + " (" + e.getMessage() + ")", e);</span>
}
} else {
<span class="nc" id="L454"> throw new IOException(</span>
"unknown queryType " + queryType + " for query " + queryValue);
}
}
}
</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>