/** * Add request settings for morelikethis * * @param MoreLikeThisComponent $component * @param Request $request * @return Request */ public function buildComponent($component, $request) { // enable morelikethis $request->addParam('mlt', 'true'); $request->addParam('mlt.fl', count($component->getFields()) ? implode(',', $component->getFields()) : null); $request->addParam('mlt.mintf', $component->getMinimumTermFrequency()); $request->addParam('mlt.mindf', $component->getMinimumDocumentFrequency()); $request->addParam('mlt.minwl', $component->getMinimumWordLength()); $request->addParam('mlt.maxwl', $component->getMaximumWordLength()); $request->addParam('mlt.maxqt', $component->getMaximumQueryTerms()); $request->addParam('mlt.maxntp', $component->getMaximumNumberOfTokens()); $request->addParam('mlt.boost', $component->getBoost()); $request->addParam('mlt.qf', count($component->getQueryFields()) ? implode(',', $component->getQueryFields()) : null); $request->addParam('mlt.count', $component->getCount()); return $request; }
public function testSetAndGetMinimumTermFrequency() { $value = 2; $this->mlt->setMinimumTermFrequency($value); $this->assertEquals($value, $this->mlt->getMinimumTermFrequency()); }