MtasJoinQParser.java.html 3.88 KB
<?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>MtasJoinQParser.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.search</a> &gt; <span class="el_source">MtasJoinQParser.java</span></div><h1>MtasJoinQParser.java</h1><pre class="source lang-java linenums">package mtas.solr.search;

import org.apache.lucene.search.Query;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.search.QParser;
import org.apache.solr.search.SyntaxError;

/**
 * The Class MtasJoinQParser.
 */
public class MtasJoinQParser extends QParser {

  /** The Constant MTAS_JOIN_QPARSER_URL. */
  public static final String MTAS_JOIN_QPARSER_URL = &quot;url&quot;;

  /** The Constant MTAS_JOIN_QPARSER_REQUEST. */
  public static final String MTAS_JOIN_QPARSER_REQUEST = &quot;request&quot;;

  /** The url. */
<span class="nc" id="L21">  String url = null;</span>

  /** The request. */
<span class="nc" id="L24">  String request = null;</span>

  /**
   * Instantiates a new mtas join Q parser.
   *
   * @param qstr the qstr
   * @param localParams the local params
   * @param params the params
   * @param req the req
   */
  public MtasJoinQParser(String qstr, SolrParams localParams, SolrParams params,
      SolrQueryRequest req) {
<span class="nc" id="L36">    super(qstr, localParams, params, req);</span>

    // SearchComponent sc = req.getCore().getSearchComponent(&quot;mtas&quot;);
    // if ((sc != null) &amp;&amp; (sc instanceof MtasSolrSearchComponent)) {
    // msc = (MtasSolrSearchComponent) sc;
    // }
<span class="nc bnc" id="L42" title="All 2 branches missed.">    if ((localParams.getParams(MTAS_JOIN_QPARSER_URL) != null)</span>
<span class="nc bnc" id="L43" title="All 2 branches missed.">        &amp;&amp; (localParams.getParams(MTAS_JOIN_QPARSER_URL).length == 1)) {</span>
<span class="nc" id="L44">      url = localParams.getParams(MTAS_JOIN_QPARSER_URL)[0];</span>
    }
<span class="nc bnc" id="L46" title="All 2 branches missed.">    if ((localParams.getParams(MTAS_JOIN_QPARSER_REQUEST) != null)</span>
<span class="nc bnc" id="L47" title="All 2 branches missed.">        &amp;&amp; (localParams.getParams(MTAS_JOIN_QPARSER_REQUEST).length == 1)) {</span>
<span class="nc" id="L48">      request = localParams.getParams(MTAS_JOIN_QPARSER_REQUEST)[0];</span>
    }
<span class="nc" id="L50">  }</span>

  /*
   * (non-Javadoc)
   * 
   * @see org.apache.solr.search.QParser#parse()
   */
  @Override
  public Query parse() throws SyntaxError {
<span class="nc bnc" id="L59" title="All 2 branches missed.">    if (url == null) {</span>
<span class="nc" id="L60">      throw new SyntaxError(&quot;no &quot; + MTAS_JOIN_QPARSER_URL);</span>
<span class="nc bnc" id="L61" title="All 2 branches missed.">    } else if (request == null) {</span>
<span class="nc" id="L62">      throw new SyntaxError(&quot;no &quot; + MTAS_JOIN_QPARSER_REQUEST);</span>
    } else {
<span class="nc" id="L64">      return null;</span>
    }
  }

}
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.7.9.201702052155</span></div></body></html>