MtasSolrComponentDocument.java.html
23.5 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
<?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>MtasSolrComponentDocument.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">MtasSolrComponentDocument.java</span></div><h1>MtasSolrComponentDocument.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.Set;
import java.util.SortedSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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 mtas.codec.util.CodecComponent.ComponentDocument;
import mtas.codec.util.CodecComponent.ComponentField;
import mtas.codec.util.CodecComponent.ComponentFields;
import mtas.codec.util.collector.MtasDataCollector;
import mtas.solr.handler.component.MtasSolrSearchComponent;
/**
* The Class MtasSolrComponentDocument.
*/
public class MtasSolrComponentDocument
implements MtasSolrComponent<ComponentDocument> {
/** The Constant log. */
<span class="fc" id="L29"> private static final Log log = LogFactory</span>
<span class="fc" id="L30"> .getLog(MtasSolrComponentDocument.class);</span>
/** The Constant PARAM_MTAS_DOCUMENT. */
public static final String PARAM_MTAS_DOCUMENT = MtasSolrSearchComponent.PARAM_MTAS
+ ".document";
/** The Constant NAME_MTAS_DOCUMENT_FIELD. */
public static final String NAME_MTAS_DOCUMENT_FIELD = "field";
/** The Constant NAME_MTAS_DOCUMENT_KEY. */
public static final String NAME_MTAS_DOCUMENT_KEY = "key";
/** The Constant NAME_MTAS_DOCUMENT_PREFIX. */
public static final String NAME_MTAS_DOCUMENT_PREFIX = "prefix";
/** The Constant NAME_MTAS_DOCUMENT_TYPE. */
public static final String NAME_MTAS_DOCUMENT_TYPE = "type";
/** The Constant NAME_MTAS_DOCUMENT_REGEXP. */
public static final String NAME_MTAS_DOCUMENT_REGEXP = "regexp";
/** The Constant NAME_MTAS_DOCUMENT_LIST. */
public static final String NAME_MTAS_DOCUMENT_LIST = "list";
/** The Constant NAME_MTAS_DOCUMENT_LIST_REGEXP. */
public static final String NAME_MTAS_DOCUMENT_LIST_REGEXP = "listRegexp";
/** The Constant NAME_MTAS_DOCUMENT_LIST_EXPAND. */
public static final String NAME_MTAS_DOCUMENT_LIST_EXPAND = "listExpand";
/** The Constant NAME_MTAS_DOCUMENT_LIST_EXPAND_NUMBER. */
public static final String NAME_MTAS_DOCUMENT_LIST_EXPAND_NUMBER = "listExpandNumber";
/** The Constant NAME_MTAS_DOCUMENT_IGNORE_REGEXP. */
public static final String NAME_MTAS_DOCUMENT_IGNORE_REGEXP = "ignoreRegexp";
/** The Constant NAME_MTAS_DOCUMENT_IGNORE_LIST. */
public static final String NAME_MTAS_DOCUMENT_IGNORE_LIST = "ignoreList";
/** The Constant NAME_MTAS_DOCUMENT_IGNORE_LIST_REGEXP. */
public static final String NAME_MTAS_DOCUMENT_IGNORE_LIST_REGEXP = "ignoreListRegexp";
/** The Constant NAME_MTAS_DOCUMENT_NUMBER. */
<span class="fc" id="L73"> public static final String NAME_MTAS_DOCUMENT_NUMBER = "number";</span>
/** The search component. */
private MtasSolrSearchComponent searchComponent;
/**
* Instantiates a new mtas solr component document.
*
* @param searchComponent the search component
*/
<span class="fc" id="L83"> public MtasSolrComponentDocument(MtasSolrSearchComponent searchComponent) {</span>
<span class="fc" id="L84"> this.searchComponent = searchComponent;</span>
<span class="fc" id="L85"> }</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="L97"> Set<String> ids = MtasSolrResultUtil</span>
<span class="nc" id="L98"> .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_DOCUMENT);</span>
<span class="nc bnc" id="L99" title="All 2 branches missed."> if (!ids.isEmpty()) {</span>
<span class="nc" id="L100"> int tmpCounter = 0;</span>
<span class="nc" id="L101"> String[] fields = new String[ids.size()];</span>
<span class="nc" id="L102"> String[] keys = new String[ids.size()];</span>
<span class="nc" id="L103"> String[] prefixes = new String[ids.size()];</span>
<span class="nc" id="L104"> String[] types = new String[ids.size()];</span>
<span class="nc" id="L105"> String[] regexps = new String[ids.size()];</span>
<span class="nc" id="L106"> String[] lists = new String[ids.size()];</span>
<span class="nc" id="L107"> Boolean[] listRegexps = new Boolean[ids.size()];</span>
<span class="nc" id="L108"> Boolean[] listExpands = new Boolean[ids.size()];</span>
<span class="nc" id="L109"> int[] listExpandNumbers = new int[ids.size()];</span>
<span class="nc" id="L110"> String[] ignoreRegexps = new String[ids.size()];</span>
<span class="nc" id="L111"> String[] ignoreLists = new String[ids.size()];</span>
<span class="nc" id="L112"> Boolean[] ignoreListRegexps = new Boolean[ids.size()];</span>
<span class="nc" id="L113"> String[] listNumbers = new String[ids.size()];</span>
<span class="nc bnc" id="L114" title="All 2 branches missed."> for (String id : ids) {</span>
<span class="nc" id="L115"> fields[tmpCounter] = rb.req.getParams().get(</span>
<span class="nc" id="L116"> PARAM_MTAS_DOCUMENT + "." + id + "." + NAME_MTAS_DOCUMENT_FIELD,</span>
<span class="nc" id="L117"> null);</span>
<span class="nc" id="L118"> keys[tmpCounter] = rb.req.getParams()</span>
<span class="nc" id="L119"> .get(PARAM_MTAS_DOCUMENT + "." + id + "." + NAME_MTAS_DOCUMENT_KEY,</span>
<span class="nc" id="L120"> String.valueOf(tmpCounter))</span>
<span class="nc" id="L121"> .trim();</span>
<span class="nc" id="L122"> prefixes[tmpCounter] = rb.req.getParams().get(</span>
<span class="nc" id="L123"> PARAM_MTAS_DOCUMENT + "." + id + "." + NAME_MTAS_DOCUMENT_PREFIX,</span>
<span class="nc" id="L124"> null);</span>
<span class="nc" id="L125"> types[tmpCounter] = rb.req.getParams().get(</span>
<span class="nc" id="L126"> PARAM_MTAS_DOCUMENT + "." + id + "." + NAME_MTAS_DOCUMENT_TYPE,</span>
<span class="nc" id="L127"> null);</span>
<span class="nc" id="L128"> regexps[tmpCounter] = rb.req.getParams().get(</span>
<span class="nc" id="L129"> PARAM_MTAS_DOCUMENT + "." + id + "." + NAME_MTAS_DOCUMENT_REGEXP,</span>
<span class="nc" id="L130"> null);</span>
<span class="nc" id="L131"> lists[tmpCounter] = rb.req.getParams().get(</span>
<span class="nc" id="L132"> PARAM_MTAS_DOCUMENT + "." + id + "." + NAME_MTAS_DOCUMENT_LIST,</span>
<span class="nc" id="L133"> null);</span>
<span class="nc" id="L134"> listRegexps[tmpCounter] = rb.req.getParams().getBool(PARAM_MTAS_DOCUMENT</span>
<span class="nc" id="L135"> + "." + id + "." + NAME_MTAS_DOCUMENT_LIST_REGEXP, false);</span>
<span class="nc" id="L136"> listExpands[tmpCounter] = rb.req.getParams().getBool(PARAM_MTAS_DOCUMENT</span>
<span class="nc" id="L137"> + "." + id + "." + NAME_MTAS_DOCUMENT_LIST_EXPAND, false);</span>
<span class="nc" id="L138"> listExpandNumbers[tmpCounter] = rb.req.getParams()</span>
<span class="nc" id="L139"> .getInt(PARAM_MTAS_DOCUMENT + "." + id + "."</span>
<span class="nc" id="L140"> + NAME_MTAS_DOCUMENT_LIST_EXPAND_NUMBER, 10);</span>
<span class="nc" id="L141"> ignoreRegexps[tmpCounter] = rb.req.getParams().get(PARAM_MTAS_DOCUMENT</span>
<span class="nc" id="L142"> + "." + id + "." + NAME_MTAS_DOCUMENT_IGNORE_REGEXP, null);</span>
<span class="nc" id="L143"> ignoreLists[tmpCounter] = rb.req.getParams().get(PARAM_MTAS_DOCUMENT</span>
<span class="nc" id="L144"> + "." + id + "." + NAME_MTAS_DOCUMENT_IGNORE_LIST, null);</span>
<span class="nc" id="L145"> ignoreListRegexps[tmpCounter] = rb.req.getParams()</span>
<span class="nc" id="L146"> .getBool(PARAM_MTAS_DOCUMENT + "." + id + "."</span>
<span class="nc" id="L147"> + NAME_MTAS_DOCUMENT_IGNORE_LIST_REGEXP, false);</span>
<span class="nc" id="L148"> listNumbers[tmpCounter] = rb.req.getParams().get(</span>
<span class="nc" id="L149"> PARAM_MTAS_DOCUMENT + "." + id + "." + NAME_MTAS_DOCUMENT_NUMBER,</span>
<span class="nc" id="L150"> null);</span>
<span class="nc" id="L151"> tmpCounter++;</span>
}
<span class="nc" id="L153"> String uniqueKeyField = rb.req.getSchema().getUniqueKeyField().getName();</span>
<span class="nc" id="L154"> mtasFields.doDocument = true;</span>
<span class="nc" id="L155"> rb.setNeedDocList(true);</span>
<span class="nc bnc" id="L156" title="All 2 branches missed."> for (String field : fields) {</span>
<span class="nc bnc" id="L157" title="All 4 branches missed."> if (field == null || field.isEmpty()) {</span>
<span class="nc" id="L158"> throw new IOException("no (valid) field in mtas document");</span>
<span class="nc bnc" id="L159" title="All 2 branches missed."> } else if (!mtasFields.list.containsKey(field)) {</span>
<span class="nc" id="L160"> mtasFields.list.put(field, new ComponentField(uniqueKeyField));</span>
}
}
<span class="nc" id="L163"> MtasSolrResultUtil.compareAndCheck(keys, fields, NAME_MTAS_DOCUMENT_KEY,</span>
<span class="nc" id="L164"> NAME_MTAS_DOCUMENT_FIELD, true);</span>
<span class="nc" id="L165"> MtasSolrResultUtil.compareAndCheck(prefixes, fields,</span>
<span class="nc" id="L166"> NAME_MTAS_DOCUMENT_PREFIX, NAME_MTAS_DOCUMENT_FIELD, false);</span>
<span class="nc" id="L167"> MtasSolrResultUtil.compareAndCheck(types, fields, NAME_MTAS_DOCUMENT_TYPE,</span>
<span class="nc" id="L168"> NAME_MTAS_DOCUMENT_FIELD, false);</span>
<span class="nc" id="L169"> MtasSolrResultUtil.compareAndCheck(regexps, fields,</span>
<span class="nc" id="L170"> NAME_MTAS_DOCUMENT_REGEXP, NAME_MTAS_DOCUMENT_FIELD, false);</span>
<span class="nc" id="L171"> MtasSolrResultUtil.compareAndCheck(lists, fields, NAME_MTAS_DOCUMENT_LIST,</span>
<span class="nc" id="L172"> NAME_MTAS_DOCUMENT_FIELD, false);</span>
<span class="nc" id="L173"> MtasSolrResultUtil.compareAndCheck(ignoreRegexps, fields,</span>
<span class="nc" id="L174"> NAME_MTAS_DOCUMENT_IGNORE_REGEXP, NAME_MTAS_DOCUMENT_FIELD, false);</span>
<span class="nc" id="L175"> MtasSolrResultUtil.compareAndCheck(ignoreLists, fields,</span>
<span class="nc" id="L176"> NAME_MTAS_DOCUMENT_IGNORE_LIST, NAME_MTAS_DOCUMENT_FIELD, false);</span>
<span class="nc" id="L177"> MtasSolrResultUtil.compareAndCheck(listNumbers, fields,</span>
<span class="nc" id="L178"> NAME_MTAS_DOCUMENT_NUMBER, NAME_MTAS_DOCUMENT_FIELD, false);</span>
<span class="nc bnc" id="L179" title="All 2 branches missed."> for (int i = 0; i < fields.length; i++) {</span>
<span class="nc bnc" id="L180" title="All 4 branches missed."> String key = (keys[i] == null) || (keys[i].isEmpty())</span>
<span class="nc" id="L181"> ? String.valueOf(i) + ":" + fields[i] + ":" + prefixes[i]</span>
<span class="nc" id="L182"> : keys[i].trim();</span>
<span class="nc" id="L183"> String prefix = prefixes[i];</span>
<span class="nc bnc" id="L184" title="All 4 branches missed."> if (prefix == null || prefix.isEmpty()) {</span>
<span class="nc" id="L185"> throw new IOException("no (valid) prefix in mtas document");</span>
}
<span class="nc" id="L187"> String type = types[i];</span>
<span class="nc" id="L188"> String regexp = regexps[i];</span>
<span class="nc" id="L189"> String[] list = null;</span>
<span class="nc" id="L190"> Boolean listRegexp = listRegexps[i];</span>
<span class="nc" id="L191"> Boolean listExpand = listExpands[i];</span>
<span class="nc" id="L192"> int listExpandNumber = listExpandNumbers[i];</span>
<span class="nc bnc" id="L193" title="All 2 branches missed."> if (lists[i] != null) {</span>
<span class="nc" id="L194"> ArrayList<String> tmpList = new ArrayList<>();</span>
<span class="nc" id="L195"> String[] subList = lists[i].split("(?<!\\\\),");</span>
<span class="nc bnc" id="L196" title="All 2 branches missed."> for (int j = 0; j < subList.length; j++) {</span>
<span class="nc" id="L197"> tmpList.add(subList[j].replace("\\,", ",").replace("\\\\", "\\"));</span>
}
<span class="nc" id="L199"> list = tmpList.toArray(new String[tmpList.size()]);</span>
}
<span class="nc" id="L201"> int listNumber = Math.max(0,</span>
<span class="nc bnc" id="L202" title="All 4 branches missed."> (listNumbers[i] == null) || (listNumbers[i].isEmpty()) ? 0</span>
<span class="nc" id="L203"> : Integer.parseInt(listNumbers[i]));</span>
<span class="nc" id="L204"> String ignoreRegexp = ignoreRegexps[i];</span>
<span class="nc" id="L205"> String[] ignoreList = null;</span>
<span class="nc" id="L206"> Boolean ignoreListRegexp = ignoreListRegexps[i];</span>
<span class="nc bnc" id="L207" title="All 2 branches missed."> if (ignoreLists[i] != null) {</span>
<span class="nc" id="L208"> ArrayList<String> tmpList = new ArrayList<>();</span>
<span class="nc" id="L209"> String[] subList = ignoreLists[i].split("(?<!\\\\),");</span>
<span class="nc bnc" id="L210" title="All 2 branches missed."> for (int j = 0; j < subList.length; j++) {</span>
<span class="nc" id="L211"> tmpList.add(subList[j].replace("\\,", ",").replace("\\\\", "\\"));</span>
}
<span class="nc" id="L213"> ignoreList = tmpList.toArray(new String[tmpList.size()]);</span>
}
<span class="nc" id="L215"> mtasFields.list.get(fields[i]).documentList.add(new ComponentDocument(</span>
<span class="nc" id="L216"> key, prefix, type, regexp, list, listNumber, listRegexp, listExpand,</span>
<span class="nc" id="L217"> listExpandNumber, ignoreRegexp, ignoreList, ignoreListRegexp));</span>
}
}
<span class="nc" id="L220"> }</span>
/*
* (non-Javadoc)
*
* @see
* mtas.solr.handler.component.util.MtasSolrComponent#create(mtas.codec.util.
* CodecComponent.BasicComponent, java.lang.Boolean)
*/
public SimpleOrderedMap<Object> create(ComponentDocument document,
Boolean encode) throws IOException {
<span class="nc" id="L231"> SimpleOrderedMap<Object> mtasDocumentResponse = new SimpleOrderedMap<>();</span>
<span class="nc" id="L232"> mtasDocumentResponse.add("key", document.key);</span>
<span class="nc" id="L233"> ArrayList<NamedList<Object>> mtasDocumentItemResponses = new ArrayList<>();</span>
<span class="nc bnc" id="L234" title="All 2 branches missed."> for (int docId : document.statsData.keySet()) {</span>
<span class="nc" id="L235"> NamedList<Object> mtasDocumentItemResponse = new SimpleOrderedMap<>();</span>
<span class="nc" id="L236"> MtasDataCollector<?, ?> stats = document.statsData.get(docId);</span>
<span class="nc" id="L237"> MtasDataCollector<?, ?> list = null;</span>
<span class="nc bnc" id="L238" title="All 2 branches missed."> if (document.statsList != null) {</span>
<span class="nc" id="L239"> list = document.statsList.get(docId);</span>
}
<span class="nc" id="L241"> mtasDocumentItemResponse.add("stats",</span>
<span class="nc" id="L242"> new MtasSolrMtasResult(stats, stats.getDataType(),</span>
<span class="nc" id="L243"> stats.getStatsType(), stats.getStatsItems(), null));</span>
<span class="nc" id="L244"> mtasDocumentItemResponse.add("documentKey",</span>
<span class="nc" id="L245"> document.uniqueKey.get(docId));</span>
<span class="nc bnc" id="L246" title="All 2 branches missed."> if (list != null) {</span>
<span class="nc bnc" id="L247" title="All 2 branches missed."> if (document.listExpand) {</span>
<span class="nc" id="L248"> mtasDocumentItemResponse.add("list", new MtasSolrMtasResult(list,</span>
<span class="nc" id="L249"> new String[] { list.getDataType(), list.getDataType() },</span>
<span class="nc" id="L250"> new String[] { list.getStatsType(), list.getStatsType() },</span>
<span class="nc" id="L251"> new SortedSet[] { list.getStatsItems(), list.getStatsItems() },</span>
<span class="nc" id="L252"> new String[] { null, null }, new String[] { null, null },</span>
<span class="nc" id="L253"> new Integer[] { 0, 0 }, new Integer[] { 1, 1 }, null));</span>
<span class="nc" id="L254"> } else {</span>
<span class="nc" id="L255"> mtasDocumentItemResponse.add("list",</span>
<span class="nc" id="L256"> new MtasSolrMtasResult(list, list.getDataType(),</span>
<span class="nc" id="L257"> list.getStatsType(), list.getStatsItems(), null));</span>
}
}
// add
<span class="nc" id="L262"> mtasDocumentItemResponses.add(mtasDocumentItemResponse);</span>
}
<span class="nc" id="L264"> mtasDocumentResponse.add("list", mtasDocumentItemResponses);</span>
<span class="nc" id="L265"> MtasSolrResultUtil.rewrite(mtasDocumentResponse, searchComponent);</span>
<span class="nc" id="L266"> return mtasDocumentResponse;</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="L280" title="All 2 branches missed."> if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)</span>
<span class="nc bnc" id="L281" title="All 2 branches missed."> && sreq.params.getBool(PARAM_MTAS_DOCUMENT, false)) {</span>
<span class="nc bnc" id="L282" title="All 2 branches missed."> if ((sreq.purpose & ShardRequest.PURPOSE_GET_FIELDS) != 0) {</span>
// do nothing
} else {
<span class="nc" id="L285"> Set<String> keys = MtasSolrResultUtil</span>
<span class="nc" id="L286"> .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_DOCUMENT);</span>
<span class="nc" id="L287"> sreq.params.remove(PARAM_MTAS_DOCUMENT);</span>
<span class="nc bnc" id="L288" title="All 2 branches missed."> for (String key : keys) {</span>
<span class="nc" id="L289"> sreq.params.remove(</span>
<span class="nc" id="L290"> PARAM_MTAS_DOCUMENT + "." + key + "." + NAME_MTAS_DOCUMENT_FIELD);</span>
<span class="nc" id="L291"> sreq.params.remove(</span>
<span class="nc" id="L292"> PARAM_MTAS_DOCUMENT + "." + key + "." + NAME_MTAS_DOCUMENT_KEY);</span>
<span class="nc" id="L293"> sreq.params.remove(PARAM_MTAS_DOCUMENT + "." + key + "."</span>
<span class="nc" id="L294"> + NAME_MTAS_DOCUMENT_PREFIX);</span>
}
}
}
<span class="nc" id="L299"> }</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="L309" title="All 2 branches missed."> if (rb.req.getParams().getBool(MtasSolrSearchComponent.PARAM_MTAS, false)</span>
<span class="nc bnc" id="L310" title="All 2 branches missed."> && rb.stage >= ResponseBuilder.STAGE_EXECUTE_QUERY</span>
<span class="nc bnc" id="L311" title="All 2 branches missed."> && rb.stage < ResponseBuilder.STAGE_GET_FIELDS) {</span>
<span class="nc bnc" id="L312" title="All 2 branches missed."> for (ShardRequest sreq : rb.finished) {</span>
<span class="nc bnc" id="L313" title="All 2 branches missed."> if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)</span>
<span class="nc" id="L314"> && sreq.params.getBool(PARAM_MTAS_DOCUMENT, false)) {</span>
// nothing to do
}
}
}
<span class="nc" id="L319"> }</span>
/*
* (non-Javadoc)
*
* @see
* mtas.solr.handler.component.util.MtasSolrComponent#distributedProcess(org.
* apache.solr.handler.component.ResponseBuilder,
* mtas.codec.util.CodecComponent.ComponentFields)
*/
public void distributedProcess(ResponseBuilder rb, ComponentFields mtasFields)
throws IOException {
// rewrite
<span class="nc" id="L332"> NamedList<Object> mtasResponse = null;</span>
try {
<span class="nc" id="L334"> mtasResponse = (NamedList<Object>) rb.rsp.getValues().get("mtas");</span>
<span class="nc" id="L335"> } catch (ClassCastException e) {</span>
<span class="nc" id="L336"> log.debug(e);</span>
<span class="nc" id="L337"> mtasResponse = null;</span>
}
<span class="nc bnc" id="L340" title="All 2 branches missed."> if (mtasResponse != null) {</span>
ArrayList<Object> mtasResponseDocument;
try {
<span class="nc" id="L343"> mtasResponseDocument = (ArrayList<Object>) mtasResponse.get("document");</span>
<span class="nc bnc" id="L344" title="All 2 branches missed."> if (mtasResponseDocument != null) {</span>
<span class="nc" id="L345"> MtasSolrResultUtil.rewrite(mtasResponseDocument, searchComponent);</span>
}
<span class="nc" id="L347"> } catch (ClassCastException e) {</span>
<span class="nc" id="L348"> log.debug(e);</span>
}
}
<span class="nc" id="L352"> }</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>