/**
  * Build request for a MoreLikeThis query
  *
  * @param Solarium_Query_MoreLikeThis $query
  * @return Solarium_Client_Request
  */
 public function build($query)
 {
     $request = parent::build($query);
     // add mlt params to request
     $request->addParam('mlt.interestingTerms', $query->getInterestingTerms());
     $request->addParam('mlt.match.include', $query->getMatchInclude());
     $request->addParam('mlt.match.offset', $query->getStart());
     $request->addParam('mlt.fl', $query->getMltFields());
     $request->addParam('mlt.mintf', $query->getMinimumTermFrequency());
     $request->addParam('mlt.mindf', $query->getMinimumDocumentFrequency());
     $request->addParam('mlt.minwl', $query->getMinimumWordLength());
     $request->addParam('mlt.maxwl', $query->getMaximumWordLength());
     $request->addParam('mlt.maxqt', $query->getMaximumQueryTerms());
     $request->addParam('mlt.maxntp', $query->getMaximumNumberOfTokens());
     $request->addParam('mlt.boost', $query->getBoost());
     $request->addParam('mlt.qf', $query->getQueryFields());
     // convert query to stream if necessary
     if (true === $query->getQueryStream()) {
         $request->removeParam('q');
         $request->setRawData($query->getQuery());
         $request->setMethod(Solarium_Client_Request::METHOD_POST);
         $request->addHeader('Content-Type: text/plain; charset=utf-8');
     }
     return $request;
 }
Beispiel #2
0
 public function testWithComponent()
 {
     $this->_query->getDisMax();
     $request = $this->_builder->build($this->_query);
     $this->assertEquals('dismax', $request->getParam('defType'));
 }