<?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>MtasSolrSearchComponent.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> &gt; <a href="index.source.html" class="el_package">mtas.solr.handler.component</a> &gt; <span class="el_source">MtasSolrSearchComponent.java</span></div><h1>MtasSolrSearchComponent.java</h1><pre class="source lang-java linenums">package mtas.solr.handler.component;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;

import mtas.codec.MtasCodecPostingsFormat;
import mtas.codec.util.CodecComponent.ComponentDocument;
import mtas.codec.util.CodecComponent.ComponentFacet;
import mtas.codec.util.CodecComponent.ComponentFields;
import mtas.codec.util.CodecComponent.ComponentGroup;
import mtas.codec.util.CodecComponent.ComponentCollection;
import mtas.codec.util.CodecComponent.ComponentKwic;
import mtas.codec.util.CodecComponent.ComponentList;
import mtas.codec.util.CodecComponent.ComponentPosition;
import mtas.codec.util.CodecComponent.ComponentSpan;
import mtas.codec.util.CodecComponent.ComponentTermVector;
import mtas.codec.util.CodecComponent.ComponentToken;
import mtas.codec.util.CodecUtil;
import mtas.solr.handler.component.util.MtasSolrResultMerge;
import mtas.solr.search.MtasSolrCollectionCache;
import mtas.solr.handler.component.util.MtasSolrComponentDocument;
import mtas.solr.handler.component.util.MtasSolrComponentFacet;
import mtas.solr.handler.component.util.MtasSolrComponentGroup;
import mtas.solr.handler.component.util.MtasSolrComponentCollection;
import mtas.solr.handler.component.util.MtasSolrComponentKwic;
import mtas.solr.handler.component.util.MtasSolrComponentList;
import mtas.solr.handler.component.util.MtasSolrComponentPrefix;
import mtas.solr.handler.component.util.MtasSolrComponentStats;
import mtas.solr.handler.component.util.MtasSolrComponentTermvector;
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 org.apache.solr.search.DocList;
import org.apache.solr.search.DocSet;
import org.apache.solr.search.SolrIndexSearcher;

/**
 * The Class MtasSolrSearchComponent.
 */
<span class="fc" id="L47">public class MtasSolrSearchComponent extends SearchComponent {</span>

  /** The log. */
<span class="fc" id="L50">  private static Log log = LogFactory.getLog(MtasSolrSearchComponent.class);</span>

  /** The search component. */
  MtasSolrSearchComponent searchComponent;

  /** The Constant CONFIG_COLLECTION_CACHE_DIRECTORY. */
  public static final String CONFIG_COLLECTION_CACHE_DIRECTORY = &quot;collectionCacheDirectory&quot;;

  /** The Constant CONFIG_COLLECTION_LIFETIME. */
  public static final String CONFIG_COLLECTION_LIFETIME = &quot;collectionLifetime&quot;;

  /** The Constant CONFIG_COLLECTION_MAXIMUM_NUMBER. */
  public static final String CONFIG_COLLECTION_MAXIMUM_NUMBER = &quot;collectionMaximumNumber&quot;;

  /** The Constant CONFIG_COLLECTION_MAXIMUM_OVERFLOW. */
  public static final String CONFIG_COLLECTION_MAXIMUM_OVERFLOW = &quot;collectionMaximumOverflow&quot;;

  /** The Constant PARAM_MTAS. */
  public static final String PARAM_MTAS = &quot;mtas&quot;;

  /** The Constant STAGE_TERMVECTOR_MISSING_TOP. */
<span class="fc" id="L71">  public static final int STAGE_TERMVECTOR_MISSING_TOP = ResponseBuilder.STAGE_EXECUTE_QUERY</span>
      + 10;

  /** The Constant STAGE_TERMVECTOR_MISSING_KEY. */
<span class="fc" id="L75">  public static final int STAGE_TERMVECTOR_MISSING_KEY = ResponseBuilder.STAGE_EXECUTE_QUERY</span>
      + 11;

  /** The Constant STAGE_TERMVECTOR_FINISH. */
<span class="fc" id="L79">  public static final int STAGE_TERMVECTOR_FINISH = ResponseBuilder.STAGE_EXECUTE_QUERY</span>
      + 12;

  /** The Constant STAGE_LIST. */
<span class="fc" id="L83">  public static final int STAGE_LIST = ResponseBuilder.STAGE_EXECUTE_QUERY + 20;</span>

  /** The Constant STAGE_PREFIX. */
<span class="fc" id="L86">  public static final int STAGE_PREFIX = ResponseBuilder.STAGE_EXECUTE_QUERY</span>
      + 30;

  /** The Constant STAGE_STATS. */
<span class="fc" id="L90">  public static final int STAGE_STATS = ResponseBuilder.STAGE_EXECUTE_QUERY</span>
      + 40;

  /** The Constant STAGE_FACET. */
<span class="fc" id="L94">  public static final int STAGE_FACET = ResponseBuilder.STAGE_EXECUTE_QUERY</span>
      + 50;

  /** The Constant STAGE_GROUP. */
<span class="fc" id="L98">  public static final int STAGE_GROUP = ResponseBuilder.STAGE_EXECUTE_QUERY</span>
      + 60;

  /** The Constant STAGE_COLLECTION_INIT. */
<span class="fc" id="L102">  public static final int STAGE_COLLECTION_INIT = ResponseBuilder.STAGE_EXECUTE_QUERY</span>
      + 70;

  /** The Constant STAGE_COLLECTION_FINISH. */
<span class="fc" id="L106">  public static final int STAGE_COLLECTION_FINISH = ResponseBuilder.STAGE_EXECUTE_QUERY</span>
      + 71;

  /** The Constant STAGE_DOCUMENT. */
<span class="fc" id="L110">  public static final int STAGE_DOCUMENT = ResponseBuilder.STAGE_GET_FIELDS</span>
      + 10;

  /** The mtas solr result merge. */
  private MtasSolrResultMerge mtasSolrResultMerge;

  /** The search stats. */
  private MtasSolrComponentStats searchStats;

  /** The search termvector. */
  private MtasSolrComponentTermvector searchTermvector;

  /** The search prefix. */
  private MtasSolrComponentPrefix searchPrefix;

  /** The search facet. */
  private MtasSolrComponentFacet searchFacet;

  /** The search group. */
  private MtasSolrComponentGroup searchGroup;

  /** The search list. */
  private MtasSolrComponentList searchList;

  /** The search kwic. */
  private MtasSolrComponentKwic searchKwic;

  /** The search document. */
  private MtasSolrComponentDocument searchDocument;

  /** The search collection. */
  private MtasSolrComponentCollection searchCollection;

  /** The collection cache. */
<span class="fc" id="L144">  private MtasSolrCollectionCache collectionCache = null;</span>

  /*
   * (non-Javadoc)
   * 
   * @see
   * org.apache.solr.handler.component.SearchComponent#init(org.apache.solr.
   * common.util.NamedList)
   */
  @Override
  public void init(NamedList args) {
<span class="fc" id="L155">    super.init(args);</span>
    // init components
<span class="fc" id="L157">    searchDocument = new MtasSolrComponentDocument(this);</span>
<span class="fc" id="L158">    searchKwic = new MtasSolrComponentKwic(this);</span>
<span class="fc" id="L159">    searchList = new MtasSolrComponentList(this);</span>
<span class="fc" id="L160">    searchGroup = new MtasSolrComponentGroup(this);</span>
<span class="fc" id="L161">    searchTermvector = new MtasSolrComponentTermvector(this);</span>
<span class="fc" id="L162">    searchPrefix = new MtasSolrComponentPrefix(this);</span>
<span class="fc" id="L163">    searchStats = new MtasSolrComponentStats(this);</span>
<span class="fc" id="L164">    searchFacet = new MtasSolrComponentFacet(this);</span>
<span class="fc" id="L165">    searchCollection = new MtasSolrComponentCollection(this);</span>
    // init collection
<span class="fc" id="L167">    String collectionCacheDirectory = null;</span>
<span class="fc" id="L168">    Long collectionLifetime = null;</span>
<span class="fc" id="L169">    Integer collectionMaximumNumber = null;</span>
<span class="fc" id="L170">    Integer collectionMaximumOverflow = null;</span>
<span class="pc bpc" id="L171" title="1 of 2 branches missed.">    if (args.get(CONFIG_COLLECTION_CACHE_DIRECTORY) != null</span>
<span class="pc bpc" id="L172" title="1 of 2 branches missed.">        &amp;&amp; args.get(CONFIG_COLLECTION_CACHE_DIRECTORY) instanceof String) {</span>
<span class="fc" id="L173">      collectionCacheDirectory = (String) args</span>
<span class="fc" id="L174">          .get(CONFIG_COLLECTION_CACHE_DIRECTORY);</span>
    }
<span class="pc bpc" id="L176" title="1 of 2 branches missed.">    if (args.get(CONFIG_COLLECTION_LIFETIME) != null</span>
<span class="pc bpc" id="L177" title="1 of 2 branches missed.">        &amp;&amp; args.get(CONFIG_COLLECTION_LIFETIME) instanceof Long) {</span>
<span class="fc" id="L178">      collectionLifetime = (Long) args.get(CONFIG_COLLECTION_LIFETIME);</span>
    }
<span class="pc bpc" id="L180" title="1 of 2 branches missed.">    if (args.get(CONFIG_COLLECTION_MAXIMUM_NUMBER) != null</span>
<span class="pc bpc" id="L181" title="1 of 2 branches missed.">        &amp;&amp; args.get(CONFIG_COLLECTION_MAXIMUM_NUMBER) instanceof Integer) {</span>
<span class="fc" id="L182">      collectionMaximumNumber = (Integer) args</span>
<span class="fc" id="L183">          .get(CONFIG_COLLECTION_MAXIMUM_NUMBER);</span>
    }
<span class="pc bpc" id="L185" title="1 of 2 branches missed.">    if (args.get(CONFIG_COLLECTION_MAXIMUM_OVERFLOW) != null</span>
<span class="pc bpc" id="L186" title="1 of 2 branches missed.">        &amp;&amp; args.get(CONFIG_COLLECTION_MAXIMUM_OVERFLOW) instanceof Integer) {</span>
<span class="fc" id="L187">      collectionMaximumNumber = (Integer) args</span>
<span class="fc" id="L188">          .get(CONFIG_COLLECTION_MAXIMUM_OVERFLOW);</span>
    }
<span class="fc" id="L190">    collectionCache = new MtasSolrCollectionCache(collectionCacheDirectory,</span>
        collectionLifetime, collectionMaximumNumber, collectionMaximumOverflow);
<span class="fc" id="L192">  }</span>

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.solr.handler.component.SearchComponent#getVersion()
   */
  @Override
  public String getVersion() {
<span class="nc" id="L201">    return String.valueOf(MtasCodecPostingsFormat.VERSION_CURRENT);</span>
  }

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.solr.handler.component.SearchComponent#getDescription()
   */
  @Override
  public String getDescription() {
<span class="fc" id="L211">    return &quot;Mtas&quot;;</span>
  }

  /**
   * Gets the collection cache.
   *
   * @return the collection cache
   */
  public MtasSolrCollectionCache getCollectionCache() {
<span class="fc" id="L220">    return collectionCache;</span>
  }

  /*
   * (non-Javadoc)
   * 
   * @see
   * org.apache.solr.handler.component.SearchComponent#prepare(org.apache.solr.
   * handler.component.ResponseBuilder)
   */
  @Override
  public void prepare(ResponseBuilder rb) throws IOException {
    // System.out
    // .println(System.nanoTime() + &quot; - &quot; + Thread.currentThread().getId()
    // + &quot; - &quot; + rb.req.getParams().getBool(&quot;isShard&quot;, false) + &quot; PREPARE &quot;
    // + rb.stage + &quot; &quot; + rb.req.getParamString());
<span class="fc bfc" id="L236" title="All 2 branches covered.">    if (rb.req.getParams().getBool(PARAM_MTAS, false)) {</span>
<span class="fc" id="L237">      mtasSolrResultMerge = new MtasSolrResultMerge();</span>
<span class="fc" id="L238">      ComponentFields mtasFields = new ComponentFields();</span>
      // get settings document
<span class="fc" id="L240">      if (rb.req.getParams()</span>
<span class="pc bpc" id="L241" title="1 of 2 branches missed.">          .getBool(MtasSolrComponentDocument.PARAM_MTAS_DOCUMENT, false)) {</span>
<span class="nc" id="L242">        searchDocument.prepare(rb, mtasFields);</span>
      }
      // get settings kwic
<span class="pc bpc" id="L245" title="1 of 2 branches missed.">      if (rb.req.getParams().getBool(MtasSolrComponentKwic.PARAM_MTAS_KWIC,</span>
          false)) {
<span class="nc" id="L247">        searchKwic.prepare(rb, mtasFields);</span>
      }
      // get settings list
<span class="pc bpc" id="L250" title="1 of 2 branches missed.">      if (rb.req.getParams().getBool(MtasSolrComponentList.PARAM_MTAS_LIST,</span>
          false)) {
<span class="nc" id="L252">        searchList.prepare(rb, mtasFields);</span>
      }
      // get settings group
<span class="pc bpc" id="L255" title="1 of 2 branches missed.">      if (rb.req.getParams().getBool(MtasSolrComponentGroup.PARAM_MTAS_GROUP,</span>
          false)) {
<span class="nc" id="L257">        searchGroup.prepare(rb, mtasFields);</span>
      }
      // get settings termvector
<span class="fc" id="L260">      if (rb.req.getParams()</span>
<span class="fc bfc" id="L261" title="All 2 branches covered.">          .getBool(MtasSolrComponentTermvector.PARAM_MTAS_TERMVECTOR, false)) {</span>
<span class="fc" id="L262">        searchTermvector.prepare(rb, mtasFields);</span>
      }
      // get settings prefix
<span class="fc bfc" id="L265" title="All 2 branches covered.">      if (rb.req.getParams().getBool(MtasSolrComponentPrefix.PARAM_MTAS_PREFIX,</span>
          false)) {
<span class="fc" id="L267">        searchPrefix.prepare(rb, mtasFields);</span>
      }
      // get settings stats
<span class="fc bfc" id="L270" title="All 2 branches covered.">      if (rb.req.getParams().getBool(MtasSolrComponentStats.PARAM_MTAS_STATS,</span>
          false)) {
<span class="fc" id="L272">        searchStats.prepare(rb, mtasFields);</span>
      }
      // get settings facet
<span class="pc bpc" id="L275" title="1 of 2 branches missed.">      if (rb.req.getParams().getBool(MtasSolrComponentFacet.PARAM_MTAS_FACET,</span>
          false)) {
<span class="nc" id="L277">        searchFacet.prepare(rb, mtasFields);</span>
      }
      // get settings collection
<span class="fc" id="L280">      if (rb.req.getParams()</span>
<span class="fc bfc" id="L281" title="All 2 branches covered.">          .getBool(MtasSolrComponentCollection.PARAM_MTAS_COLLECTION, false)) {</span>
<span class="fc" id="L282">        searchCollection.prepare(rb, mtasFields);</span>
      }
<span class="fc" id="L284">      rb.req.getContext().put(ComponentFields.class, mtasFields);</span>
    }
<span class="fc" id="L286">  }</span>

  /*
   * (non-Javadoc)
   * 
   * @see
   * org.apache.solr.handler.component.SearchComponent#process(org.apache.solr.
   * handler.component.ResponseBuilder)
   */
  @Override
  public void process(ResponseBuilder rb) throws IOException {
    // System.out
    // .println(System.nanoTime() + &quot; - &quot; + Thread.currentThread().getId()
    // + &quot; - &quot; + rb.req.getParams().getBool(&quot;isShard&quot;, false) + &quot; PROCESS &quot;
    // + rb.stage + &quot; &quot; + rb.req.getParamString());
<span class="fc" id="L301">    ComponentFields mtasFields = getMtasFields(rb);</span>
<span class="fc bfc" id="L302" title="All 2 branches covered.">    if (mtasFields != null) {</span>
<span class="fc" id="L303">      DocSet docSet = rb.getResults().docSet;</span>
<span class="fc" id="L304">      DocList docList = rb.getResults().docList;</span>
<span class="pc bpc" id="L305" title="5 of 18 branches missed.">      if (mtasFields.doStats || mtasFields.doDocument || mtasFields.doKwic</span>
          || mtasFields.doList || mtasFields.doGroup || mtasFields.doFacet
          || mtasFields.doCollection || mtasFields.doTermVector
          || mtasFields.doPrefix) {
<span class="fc" id="L309">        SolrIndexSearcher searcher = rb.req.getSearcher();</span>
<span class="fc" id="L310">        ArrayList&lt;Integer&gt; docSetList = null;</span>
<span class="fc" id="L311">        ArrayList&lt;Integer&gt; docListList = null;</span>
<span class="fc bfc" id="L312" title="All 2 branches covered.">        if (docSet != null) {</span>
<span class="fc" id="L313">          docSetList = new ArrayList&lt;&gt;();</span>
<span class="fc" id="L314">          Iterator&lt;Integer&gt; docSetIterator = docSet.iterator();</span>
<span class="fc bfc" id="L315" title="All 2 branches covered.">          while (docSetIterator.hasNext()) {</span>
<span class="fc" id="L316">            docSetList.add(docSetIterator.next());</span>
          }
<span class="fc" id="L318">          Collections.sort(docSetList);</span>
        }
<span class="pc bpc" id="L320" title="1 of 2 branches missed.">        if (docList != null) {</span>
<span class="fc" id="L321">          docListList = new ArrayList&lt;&gt;();</span>
<span class="fc" id="L322">          Iterator&lt;Integer&gt; docListIterator = docList.iterator();</span>
<span class="fc bfc" id="L323" title="All 2 branches covered.">          while (docListIterator.hasNext()) {</span>
<span class="fc" id="L324">            docListList.add(docListIterator.next());</span>
          }
<span class="fc" id="L326">          Collections.sort(docListList);</span>
        }
<span class="fc bfc" id="L328" title="All 2 branches covered.">        for (String field : mtasFields.list.keySet()) {</span>
          try {
<span class="fc" id="L330">            CodecUtil.collectField(field, searcher, searcher.getRawReader(),</span>
<span class="fc" id="L331">                docListList, docSetList, mtasFields.list.get(field));</span>
<span class="nc" id="L332">          } catch (IllegalAccessException | IllegalArgumentException</span>
              | InvocationTargetException e) {
<span class="nc" id="L334">            log.error(e);</span>
<span class="nc" id="L335">            throw new IOException(e);</span>
<span class="fc" id="L336">          }</span>
<span class="fc" id="L337">        }</span>
<span class="fc bfc" id="L338" title="All 2 branches covered.">        for (ComponentCollection collection : mtasFields.collection) {</span>
<span class="fc" id="L339">          CodecUtil.collectCollection(searcher.getRawReader(), docSetList,</span>
              collection);
<span class="fc" id="L341">        }</span>
<span class="fc" id="L342">        NamedList&lt;Object&gt; mtasResponse = new SimpleOrderedMap&lt;&gt;();</span>
<span class="pc bpc" id="L343" title="1 of 2 branches missed.">        if (mtasFields.doDocument) {</span>
<span class="nc" id="L344">          ArrayList&lt;NamedList&lt;?&gt;&gt; mtasDocumentResponses = new ArrayList&lt;&gt;();</span>
<span class="nc bnc" id="L345" title="All 2 branches missed.">          for (String field : mtasFields.list.keySet()) {</span>
            for (ComponentDocument document : mtasFields.list
<span class="nc bnc" id="L347" title="All 2 branches missed.">                .get(field).documentList) {</span>
<span class="nc" id="L348">              mtasDocumentResponses.add(searchDocument.create(document, false));</span>
<span class="nc" id="L349">            }</span>
<span class="nc" id="L350">          }</span>
          // add to response
<span class="nc" id="L352">          mtasResponse.add(&quot;document&quot;, mtasDocumentResponses);</span>
        }
<span class="pc bpc" id="L354" title="1 of 2 branches missed.">        if (mtasFields.doKwic) {</span>
<span class="nc" id="L355">          ArrayList&lt;NamedList&lt;?&gt;&gt; mtasKwicResponses = new ArrayList&lt;&gt;();</span>
<span class="nc bnc" id="L356" title="All 2 branches missed.">          for (String field : mtasFields.list.keySet()) {</span>
<span class="nc bnc" id="L357" title="All 2 branches missed.">            for (ComponentKwic kwic : mtasFields.list.get(field).kwicList) {</span>
<span class="nc" id="L358">              mtasKwicResponses.add(searchKwic.create(kwic, false));</span>
<span class="nc" id="L359">            }</span>
<span class="nc" id="L360">          }</span>
          // add to response
<span class="nc" id="L362">          mtasResponse.add(&quot;kwic&quot;, mtasKwicResponses);</span>
        }
<span class="pc bpc" id="L364" title="1 of 2 branches missed.">        if (mtasFields.doFacet) {</span>
<span class="nc" id="L365">          ArrayList&lt;NamedList&lt;?&gt;&gt; mtasFacetResponses = new ArrayList&lt;&gt;();</span>
<span class="nc bnc" id="L366" title="All 2 branches missed.">          for (String field : mtasFields.list.keySet()) {</span>
<span class="nc bnc" id="L367" title="All 2 branches missed.">            for (ComponentFacet facet : mtasFields.list.get(field).facetList) {</span>
<span class="nc bnc" id="L368" title="All 2 branches missed.">              if (rb.req.getParams().getBool(&quot;isShard&quot;, false)) {</span>
<span class="nc" id="L369">                mtasFacetResponses.add(searchFacet.create(facet, true));</span>
              } else {
<span class="nc" id="L371">                mtasFacetResponses.add(searchFacet.create(facet, false));</span>
              }
<span class="nc" id="L373">            }</span>
<span class="nc" id="L374">          }</span>
          // add to response
<span class="nc" id="L376">          mtasResponse.add(&quot;facet&quot;, mtasFacetResponses);</span>
        }
<span class="fc bfc" id="L378" title="All 2 branches covered.">        if (mtasFields.doCollection) {</span>
<span class="fc" id="L379">          ArrayList&lt;NamedList&lt;?&gt;&gt; mtasCollectionResponses = new ArrayList&lt;&gt;();</span>
<span class="fc bfc" id="L380" title="All 2 branches covered.">          for (ComponentCollection collection : mtasFields.collection) {</span>
<span class="fc bfc" id="L381" title="All 2 branches covered.">            if (rb.req.getParams().getBool(&quot;isShard&quot;, false)) {</span>
<span class="fc" id="L382">              mtasCollectionResponses</span>
<span class="fc" id="L383">                  .add(searchCollection.create(collection, true));</span>
            } else {
<span class="fc" id="L385">              mtasCollectionResponses</span>
<span class="fc" id="L386">                  .add(searchCollection.create(collection, false));</span>
            }
<span class="fc" id="L388">          }</span>
          // add to response
<span class="fc" id="L390">          mtasResponse.add(&quot;collection&quot;, mtasCollectionResponses);</span>
        }
<span class="pc bpc" id="L392" title="1 of 2 branches missed.">        if (mtasFields.doList) {</span>
<span class="nc" id="L393">          ArrayList&lt;NamedList&lt;?&gt;&gt; mtasListResponses = new ArrayList&lt;&gt;();</span>
<span class="nc bnc" id="L394" title="All 2 branches missed.">          for (String field : mtasFields.list.keySet()) {</span>
<span class="nc bnc" id="L395" title="All 2 branches missed.">            for (ComponentList list : mtasFields.list.get(field).listList) {</span>
<span class="nc" id="L396">              mtasListResponses.add(searchList.create(list, false));</span>
<span class="nc" id="L397">            }</span>
<span class="nc" id="L398">          }</span>
          // add to response
<span class="nc" id="L400">          mtasResponse.add(&quot;list&quot;, mtasListResponses);</span>
        }
<span class="pc bpc" id="L402" title="1 of 2 branches missed.">        if (mtasFields.doGroup) {</span>
<span class="nc" id="L403">          ArrayList&lt;NamedList&lt;?&gt;&gt; mtasGroupResponses = new ArrayList&lt;&gt;();</span>
<span class="nc bnc" id="L404" title="All 2 branches missed.">          for (String field : mtasFields.list.keySet()) {</span>
<span class="nc bnc" id="L405" title="All 2 branches missed.">            for (ComponentGroup group : mtasFields.list.get(field).groupList) {</span>
<span class="nc bnc" id="L406" title="All 2 branches missed.">              if (rb.req.getParams().getBool(&quot;isShard&quot;, false)) {</span>
<span class="nc" id="L407">                mtasGroupResponses.add(searchGroup.create(group, true));</span>
              } else {
<span class="nc" id="L409">                mtasGroupResponses.add(searchGroup.create(group, false));</span>
              }
<span class="nc" id="L411">            }</span>
<span class="nc" id="L412">          }</span>
          // add to response
<span class="nc" id="L414">          mtasResponse.add(&quot;group&quot;, mtasGroupResponses);</span>
        }
<span class="fc bfc" id="L416" title="All 2 branches covered.">        if (mtasFields.doTermVector) {</span>
<span class="fc" id="L417">          ArrayList&lt;NamedList&lt;?&gt;&gt; mtasTermVectorResponses = new ArrayList&lt;&gt;();</span>
<span class="fc bfc" id="L418" title="All 2 branches covered.">          for (String field : mtasFields.list.keySet()) {</span>
            for (ComponentTermVector termVector : mtasFields.list
<span class="fc bfc" id="L420" title="All 2 branches covered.">                .get(field).termVectorList) {</span>
<span class="fc bfc" id="L421" title="All 2 branches covered.">              if (rb.req.getParams().getBool(&quot;isShard&quot;, false)) {</span>
<span class="fc" id="L422">                mtasTermVectorResponses</span>
<span class="fc" id="L423">                    .add(searchTermvector.create(termVector, true));</span>
              } else {
<span class="fc" id="L425">                mtasTermVectorResponses</span>
<span class="fc" id="L426">                    .add(searchTermvector.create(termVector, false));</span>
              }
<span class="fc" id="L428">            }</span>
<span class="fc" id="L429">          }</span>
          // add to response
<span class="fc" id="L431">          mtasResponse.add(&quot;termvector&quot;, mtasTermVectorResponses);</span>
        }
<span class="fc bfc" id="L433" title="All 2 branches covered.">        if (mtasFields.doPrefix) {</span>
<span class="fc" id="L434">          ArrayList&lt;NamedList&lt;?&gt;&gt; mtasPrefixResponses = new ArrayList&lt;&gt;();</span>
<span class="fc bfc" id="L435" title="All 2 branches covered.">          for (String field : mtasFields.list.keySet()) {</span>
<span class="pc bpc" id="L436" title="1 of 2 branches missed.">            if (mtasFields.list.get(field).prefix != null) {</span>
<span class="fc bfc" id="L437" title="All 2 branches covered.">              if (rb.req.getParams().getBool(&quot;isShard&quot;, false)) {</span>
<span class="fc" id="L438">                mtasPrefixResponses.add(searchPrefix</span>
<span class="fc" id="L439">                    .create(mtasFields.list.get(field).prefix, true));</span>
              } else {
<span class="fc" id="L441">                mtasPrefixResponses.add(searchPrefix</span>
<span class="fc" id="L442">                    .create(mtasFields.list.get(field).prefix, false));</span>
              }
            }
<span class="fc" id="L445">          }</span>
<span class="fc" id="L446">          mtasResponse.add(&quot;prefix&quot;, mtasPrefixResponses);</span>
        }
<span class="fc bfc" id="L448" title="All 2 branches covered.">        if (mtasFields.doStats) {</span>
<span class="fc" id="L449">          NamedList&lt;Object&gt; mtasStatsResponse = new SimpleOrderedMap&lt;&gt;();</span>
<span class="pc bpc" id="L450" title="1 of 6 branches missed.">          if (mtasFields.doStatsPositions || mtasFields.doStatsTokens</span>
              || mtasFields.doStatsSpans) {
<span class="fc bfc" id="L452" title="All 2 branches covered.">            if (mtasFields.doStatsTokens) {</span>
<span class="fc" id="L453">              ArrayList&lt;Object&gt; mtasStatsTokensResponses = new ArrayList&lt;&gt;();</span>
<span class="fc bfc" id="L454" title="All 2 branches covered.">              for (String field : mtasFields.list.keySet()) {</span>
                for (ComponentToken token : mtasFields.list
<span class="fc bfc" id="L456" title="All 2 branches covered.">                    .get(field).statsTokenList) {</span>
<span class="fc bfc" id="L457" title="All 2 branches covered.">                  if (rb.req.getParams().getBool(&quot;isShard&quot;, false)) {</span>
<span class="fc" id="L458">                    mtasStatsTokensResponses</span>
<span class="fc" id="L459">                        .add(searchStats.create(token, true));</span>
                  } else {
<span class="fc" id="L461">                    mtasStatsTokensResponses</span>
<span class="fc" id="L462">                        .add(searchStats.create(token, false));</span>
                  }
<span class="fc" id="L464">                }</span>
<span class="fc" id="L465">              }</span>
<span class="fc" id="L466">              mtasStatsResponse.add(&quot;tokens&quot;, mtasStatsTokensResponses);</span>
            }
<span class="fc bfc" id="L468" title="All 2 branches covered.">            if (mtasFields.doStatsPositions) {</span>
<span class="fc" id="L469">              ArrayList&lt;Object&gt; mtasStatsPositionsResponses = new ArrayList&lt;&gt;();</span>
<span class="fc bfc" id="L470" title="All 2 branches covered.">              for (String field : mtasFields.list.keySet()) {</span>
                for (ComponentPosition position : mtasFields.list
<span class="fc bfc" id="L472" title="All 2 branches covered.">                    .get(field).statsPositionList) {</span>
<span class="fc bfc" id="L473" title="All 2 branches covered.">                  if (rb.req.getParams().getBool(&quot;isShard&quot;, false)) {</span>
<span class="fc" id="L474">                    mtasStatsPositionsResponses</span>
<span class="fc" id="L475">                        .add(searchStats.create(position, true));</span>
                  } else {
<span class="fc" id="L477">                    mtasStatsPositionsResponses</span>
<span class="fc" id="L478">                        .add(searchStats.create(position, false));</span>
                  }
<span class="fc" id="L480">                }</span>
<span class="fc" id="L481">              }</span>
<span class="fc" id="L482">              mtasStatsResponse.add(&quot;positions&quot;, mtasStatsPositionsResponses);</span>
            }
<span class="fc bfc" id="L484" title="All 2 branches covered.">            if (mtasFields.doStatsSpans) {</span>
<span class="fc" id="L485">              ArrayList&lt;Object&gt; mtasStatsSpansResponses = new ArrayList&lt;&gt;();</span>
<span class="fc bfc" id="L486" title="All 2 branches covered.">              for (String field : mtasFields.list.keySet()) {</span>
                for (ComponentSpan span : mtasFields.list
<span class="fc bfc" id="L488" title="All 2 branches covered.">                    .get(field).statsSpanList) {</span>
<span class="fc bfc" id="L489" title="All 2 branches covered.">                  if (rb.req.getParams().getBool(&quot;isShard&quot;, false)) {</span>
<span class="fc" id="L490">                    mtasStatsSpansResponses.add(searchStats.create(span, true));</span>
                  } else {
<span class="fc" id="L492">                    mtasStatsSpansResponses</span>
<span class="fc" id="L493">                        .add(searchStats.create(span, false));</span>
                  }
<span class="fc" id="L495">                }</span>
<span class="fc" id="L496">              }</span>
<span class="fc" id="L497">              mtasStatsResponse.add(&quot;spans&quot;, mtasStatsSpansResponses);</span>
            }
            // add to response
<span class="fc" id="L500">            mtasResponse.add(&quot;stats&quot;, mtasStatsResponse);</span>
          }
        }
        // add to response
<span class="fc" id="L504">        rb.rsp.add(&quot;mtas&quot;, mtasResponse);</span>
      }
    }
<span class="fc" id="L507">  }</span>

  /*
   * (non-Javadoc)
   * 
   * @see
   * org.apache.solr.handler.component.SearchComponent#modifyRequest(org.apache.
   * solr.handler.component.ResponseBuilder,
   * org.apache.solr.handler.component.SearchComponent,
   * org.apache.solr.handler.component.ShardRequest)
   */
  @Override
  public void modifyRequest(ResponseBuilder rb, SearchComponent who,
      ShardRequest sreq) {
    // System.out.println(System.nanoTime() + &quot; - &quot; +
    // Thread.currentThread().getId() + &quot; - &quot;
    // + rb.req.getParams().getBool(&quot;isShard&quot;, false) + &quot; MODIFY REQUEST &quot;
    // + rb.stage + &quot; &quot; + rb.req.getParamString());
<span class="fc bfc" id="L525" title="All 2 branches covered.">    if (sreq.params.getBool(PARAM_MTAS, false)) {</span>
<span class="fc bfc" id="L526" title="All 2 branches covered.">      if (sreq.params.getBool(MtasSolrComponentStats.PARAM_MTAS_STATS, false)) {</span>
<span class="fc" id="L527">        searchStats.modifyRequest(rb, who, sreq);</span>
      }
<span class="fc bfc" id="L529" title="All 2 branches covered.">      if (sreq.params.getBool(MtasSolrComponentTermvector.PARAM_MTAS_TERMVECTOR,</span>
          false)) {
<span class="fc" id="L531">        searchTermvector.modifyRequest(rb, who, sreq);</span>
      }
<span class="fc bfc" id="L533" title="All 2 branches covered.">      if (sreq.params.getBool(MtasSolrComponentPrefix.PARAM_MTAS_PREFIX,</span>
          false)) {
<span class="fc" id="L535">        searchPrefix.modifyRequest(rb, who, sreq);</span>
      }
<span class="pc bpc" id="L537" title="1 of 2 branches missed.">      if (sreq.params.getBool(MtasSolrComponentFacet.PARAM_MTAS_FACET, false)) {</span>
<span class="nc" id="L538">        searchFacet.modifyRequest(rb, who, sreq);</span>
      }
<span class="fc bfc" id="L540" title="All 2 branches covered.">      if (sreq.params.getBool(MtasSolrComponentCollection.PARAM_MTAS_COLLECTION,</span>
          false)) {
<span class="fc" id="L542">        searchCollection.modifyRequest(rb, who, sreq);</span>
      }
<span class="pc bpc" id="L544" title="1 of 2 branches missed.">      if (sreq.params.getBool(MtasSolrComponentGroup.PARAM_MTAS_GROUP, false)) {</span>
<span class="nc" id="L545">        searchGroup.modifyRequest(rb, who, sreq);</span>
      }
<span class="pc bpc" id="L547" title="1 of 2 branches missed.">      if (sreq.params.getBool(MtasSolrComponentList.PARAM_MTAS_LIST, false)) {</span>
<span class="nc" id="L548">        searchList.modifyRequest(rb, who, sreq);</span>
      }
<span class="pc bpc" id="L550" title="1 of 2 branches missed.">      if (sreq.params.getBool(MtasSolrComponentDocument.PARAM_MTAS_DOCUMENT,</span>
          false)) {
<span class="nc" id="L552">        searchDocument.modifyRequest(rb, who, sreq);</span>
      }
<span class="pc bpc" id="L554" title="1 of 2 branches missed.">      if (sreq.params.getBool(MtasSolrComponentKwic.PARAM_MTAS_KWIC, false)) {</span>
<span class="nc" id="L555">        searchKwic.modifyRequest(rb, who, sreq);</span>
      }
    }
<span class="fc" id="L558">  }</span>

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.solr.handler.component.SearchComponent#handleResponses(org.
   * apache.solr.handler.component.ResponseBuilder,
   * org.apache.solr.handler.component.ShardRequest)
   */
  @Override
  public void handleResponses(ResponseBuilder rb, ShardRequest sreq) {
    // System.out
    // .println(System.nanoTime() + &quot; - &quot; + Thread.currentThread().getId()
    // + &quot; - &quot; + rb.req.getParams().getBool(&quot;isShard&quot;, false)
    // + &quot; HANDLERESPONSES &quot; + rb.stage + &quot; &quot; + rb.req.getParamString());
<span class="fc" id="L573">  }</span>

  /*
   * (non-Javadoc)
   * 
   * @see
   * org.apache.solr.handler.component.SearchComponent#distributedProcess(org.
   * apache.solr.handler.component.ResponseBuilder)
   */
  @Override
  public void finishStage(ResponseBuilder rb) {
    // System.out
    // .println(System.nanoTime() + &quot; - &quot; + Thread.currentThread().getId()
    // + &quot; - &quot; + rb.req.getParams().getBool(&quot;isShard&quot;, false)
    // + &quot; FINISHRESPONSES &quot; + rb.stage + &quot; &quot; + rb.req.getParamString());
<span class="fc bfc" id="L588" title="All 2 branches covered.">    if (rb.req.getParams().getBool(PARAM_MTAS, false)) {</span>
<span class="fc bfc" id="L589" title="All 2 branches covered.">      if (rb.req.getParams().getBool(MtasSolrComponentStats.PARAM_MTAS_STATS,</span>
          false)) {
<span class="fc" id="L591">        searchStats.finishStage(rb);</span>
      }
<span class="fc" id="L593">      if (rb.req.getParams()</span>
<span class="fc bfc" id="L594" title="All 2 branches covered.">          .getBool(MtasSolrComponentTermvector.PARAM_MTAS_TERMVECTOR, false)) {</span>
<span class="fc" id="L595">        searchTermvector.finishStage(rb);</span>
      }
<span class="fc bfc" id="L597" title="All 2 branches covered.">      if (rb.req.getParams().getBool(MtasSolrComponentPrefix.PARAM_MTAS_PREFIX,</span>
          false)) {
<span class="fc" id="L599">        searchPrefix.finishStage(rb);</span>
      }
<span class="pc bpc" id="L601" title="1 of 2 branches missed.">      if (rb.req.getParams().getBool(MtasSolrComponentFacet.PARAM_MTAS_FACET,</span>
          false)) {
<span class="nc" id="L603">        searchFacet.finishStage(rb);</span>
      }
<span class="fc" id="L605">      if (rb.req.getParams()</span>
<span class="fc bfc" id="L606" title="All 2 branches covered.">          .getBool(MtasSolrComponentCollection.PARAM_MTAS_COLLECTION, false)) {</span>
<span class="fc" id="L607">        searchCollection.finishStage(rb);</span>
      }
<span class="pc bpc" id="L609" title="1 of 2 branches missed.">      if (rb.req.getParams().getBool(MtasSolrComponentGroup.PARAM_MTAS_GROUP,</span>
          false)) {
<span class="nc" id="L611">        searchGroup.finishStage(rb);</span>
      }
<span class="pc bpc" id="L613" title="1 of 2 branches missed.">      if (rb.req.getParams().getBool(MtasSolrComponentList.PARAM_MTAS_LIST,</span>
          false)) {
<span class="nc" id="L615">        searchList.finishStage(rb);</span>
      }
<span class="fc" id="L617">      if (rb.req.getParams()</span>
<span class="pc bpc" id="L618" title="1 of 2 branches missed.">          .getBool(MtasSolrComponentDocument.PARAM_MTAS_DOCUMENT, false)) {</span>
<span class="nc" id="L619">        searchDocument.finishStage(rb);</span>
      }
<span class="pc bpc" id="L621" title="1 of 2 branches missed.">      if (rb.req.getParams().getBool(MtasSolrComponentKwic.PARAM_MTAS_KWIC,</span>
          false)) {
<span class="nc" id="L623">        searchKwic.finishStage(rb);</span>
      }
<span class="fc" id="L625">      mtasSolrResultMerge.merge(rb);</span>
    }
<span class="fc" id="L627">  }</span>

  /*
   * (non-Javadoc)
   * 
   * @see
   * org.apache.solr.handler.component.SearchComponent#distributedProcess(org.
   * apache.solr.handler.component.ResponseBuilder)
   */
  @Override
  public int distributedProcess(ResponseBuilder rb) throws IOException {
    // System.out.println(System.nanoTime() + &quot; - &quot; +
    // Thread.currentThread().getId() + &quot; - &quot;
    // + rb.req.getParams().getBool(&quot;isShard&quot;, false) + &quot; DISTIRBUTEDPROCESS &quot;
    // + rb.stage + &quot; &quot; + rb.req.getParamString());
    // distributed processes
<span class="fc bfc" id="L643" title="All 2 branches covered.">    if (rb.req.getParams().getBool(PARAM_MTAS, false)) {</span>
<span class="fc bfc" id="L644" title="All 6 branches covered.">      if (rb.stage == STAGE_TERMVECTOR_MISSING_TOP</span>
          || rb.stage == STAGE_TERMVECTOR_MISSING_KEY
          || rb.stage == STAGE_TERMVECTOR_FINISH) {
<span class="fc" id="L647">        ComponentFields mtasFields = getMtasFields(rb);</span>
<span class="fc" id="L648">        searchTermvector.distributedProcess(rb, mtasFields);</span>
<span class="pc bpc" id="L649" title="1 of 2 branches missed.">      } else if (rb.stage == STAGE_LIST) {</span>
<span class="nc" id="L650">        ComponentFields mtasFields = getMtasFields(rb);</span>
<span class="nc" id="L651">        searchList.distributedProcess(rb, mtasFields);</span>
<span class="pc bfc" id="L652" title="All 2 branches covered.">      } else if (rb.stage == STAGE_PREFIX) {</span>
<span class="fc" id="L653">        ComponentFields mtasFields = getMtasFields(rb);</span>
<span class="fc" id="L654">        searchPrefix.distributedProcess(rb, mtasFields);</span>
<span class="fc bfc" id="L655" title="All 2 branches covered.">      } else if (rb.stage == STAGE_STATS) {</span>
<span class="fc" id="L656">        ComponentFields mtasFields = getMtasFields(rb);</span>
<span class="fc" id="L657">        searchStats.distributedProcess(rb, mtasFields);</span>
<span class="pc bpc" id="L658" title="1 of 2 branches missed.">      } else if (rb.stage == STAGE_FACET) {</span>
<span class="nc" id="L659">        ComponentFields mtasFields = getMtasFields(rb);</span>
<span class="nc" id="L660">        searchFacet.distributedProcess(rb, mtasFields);</span>
<span class="pc bfc" id="L661" title="All 4 branches covered.">      } else if (rb.stage == STAGE_COLLECTION_INIT</span>
          || rb.stage == STAGE_COLLECTION_FINISH) {
<span class="fc" id="L663">        ComponentFields mtasFields = getMtasFields(rb);</span>
<span class="fc" id="L664">        searchCollection.distributedProcess(rb, mtasFields);</span>
<span class="pc bpc" id="L665" title="1 of 2 branches missed.">      } else if (rb.stage == STAGE_GROUP) {</span>
<span class="nc" id="L666">        ComponentFields mtasFields = getMtasFields(rb);</span>
<span class="nc" id="L667">        searchGroup.distributedProcess(rb, mtasFields);</span>
<span class="pc bpc" id="L668" title="1 of 2 branches missed.">      } else if (rb.stage == STAGE_DOCUMENT) {</span>
<span class="nc" id="L669">        ComponentFields mtasFields = getMtasFields(rb);</span>
<span class="nc" id="L670">        searchDocument.distributedProcess(rb, mtasFields);</span>
      }
      // compute new stage and return if not finished
<span class="fc bfc" id="L673" title="All 4 branches covered.">      if (rb.stage &gt;= ResponseBuilder.STAGE_EXECUTE_QUERY</span>
          &amp;&amp; rb.stage &lt; ResponseBuilder.STAGE_GET_FIELDS) {
<span class="fc bfc" id="L675" title="All 2 branches covered.">        if (rb.stage &lt; STAGE_TERMVECTOR_MISSING_TOP</span>
<span class="fc bfc" id="L676" title="All 2 branches covered.">            &amp;&amp; rb.req.getParams().getBool(</span>
                MtasSolrComponentTermvector.PARAM_MTAS_TERMVECTOR, false)) {
<span class="fc" id="L678">          return STAGE_TERMVECTOR_MISSING_TOP;</span>
<span class="fc bfc" id="L679" title="All 2 branches covered.">        } else if (rb.stage &lt; STAGE_TERMVECTOR_MISSING_KEY</span>
<span class="fc bfc" id="L680" title="All 2 branches covered.">            &amp;&amp; rb.req.getParams().getBool(</span>
                MtasSolrComponentTermvector.PARAM_MTAS_TERMVECTOR, false)) {
<span class="fc" id="L682">          return STAGE_TERMVECTOR_MISSING_KEY;</span>
<span class="fc bfc" id="L683" title="All 2 branches covered.">        } else if (rb.stage &lt; STAGE_TERMVECTOR_FINISH</span>
<span class="fc bfc" id="L684" title="All 2 branches covered.">            &amp;&amp; rb.req.getParams().getBool(</span>
                MtasSolrComponentTermvector.PARAM_MTAS_TERMVECTOR, false)) {
<span class="fc" id="L686">          return STAGE_TERMVECTOR_FINISH;</span>
<span class="fc bfc" id="L687" title="All 2 branches covered.">        } else if (rb.stage &lt; STAGE_LIST &amp;&amp; rb.req.getParams()</span>
<span class="pc bpc" id="L688" title="1 of 2 branches missed.">            .getBool(MtasSolrComponentList.PARAM_MTAS_LIST, false)) {</span>
<span class="nc" id="L689">          return STAGE_LIST;</span>
<span class="fc bfc" id="L690" title="All 2 branches covered.">        } else if (rb.stage &lt; STAGE_PREFIX &amp;&amp; rb.req.getParams()</span>
<span class="fc bfc" id="L691" title="All 2 branches covered.">            .getBool(MtasSolrComponentPrefix.PARAM_MTAS_PREFIX, false)) {</span>
<span class="fc" id="L692">          return STAGE_PREFIX;</span>
<span class="fc bfc" id="L693" title="All 2 branches covered.">        } else if (rb.stage &lt; STAGE_STATS &amp;&amp; rb.req.getParams()</span>
<span class="fc bfc" id="L694" title="All 2 branches covered.">            .getBool(MtasSolrComponentStats.PARAM_MTAS_STATS, false)) {</span>
<span class="fc" id="L695">          return STAGE_STATS;</span>
<span class="fc bfc" id="L696" title="All 2 branches covered.">        } else if (rb.stage &lt; STAGE_FACET &amp;&amp; rb.req.getParams()</span>
<span class="pc bpc" id="L697" title="1 of 2 branches missed.">            .getBool(MtasSolrComponentFacet.PARAM_MTAS_FACET, false)) {</span>
<span class="nc" id="L698">          return STAGE_FACET;</span>
<span class="fc bfc" id="L699" title="All 2 branches covered.">        } else if (rb.stage &lt; STAGE_GROUP &amp;&amp; rb.req.getParams()</span>
<span class="pc bpc" id="L700" title="1 of 2 branches missed.">            .getBool(MtasSolrComponentGroup.PARAM_MTAS_GROUP, false)) {</span>
<span class="nc" id="L701">          return STAGE_GROUP;</span>
<span class="fc bfc" id="L702" title="All 2 branches covered.">        } else if (rb.stage &lt; STAGE_COLLECTION_INIT</span>
<span class="fc bfc" id="L703" title="All 2 branches covered.">            &amp;&amp; rb.req.getParams().getBool(</span>
                MtasSolrComponentCollection.PARAM_MTAS_COLLECTION, false)) {
<span class="fc" id="L705">          return STAGE_COLLECTION_INIT;</span>
<span class="fc bfc" id="L706" title="All 2 branches covered.">        } else if (rb.stage &lt; STAGE_COLLECTION_FINISH</span>
<span class="fc bfc" id="L707" title="All 2 branches covered.">            &amp;&amp; rb.req.getParams().getBool(</span>
                MtasSolrComponentCollection.PARAM_MTAS_COLLECTION, false)) {
<span class="fc" id="L709">          return STAGE_COLLECTION_FINISH;</span>
        }
<span class="pc bpc" id="L711" title="1 of 4 branches missed.">      } else if (rb.stage &gt;= ResponseBuilder.STAGE_GET_FIELDS</span>
          &amp;&amp; rb.stage &lt; ResponseBuilder.STAGE_DONE) {
<span class="pc bpc" id="L713" title="1 of 2 branches missed.">        if (rb.stage &lt; STAGE_DOCUMENT &amp;&amp; rb.req.getParams()</span>
<span class="pc bpc" id="L714" title="1 of 2 branches missed.">            .getBool(MtasSolrComponentDocument.PARAM_MTAS_DOCUMENT, false)) {</span>
<span class="nc" id="L715">          return STAGE_DOCUMENT;</span>
        }
      }
    }
<span class="fc" id="L719">    return ResponseBuilder.STAGE_DONE;</span>
  }

  /**
   * Gets the mtas fields.
   *
   * @param rb the rb
   * @return the mtas fields
   */

  private ComponentFields getMtasFields(ResponseBuilder rb) {
<span class="fc" id="L730">    return (ComponentFields) rb.req.getContext().get(ComponentFields.class);</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>