示例#1
0
 public function testSetAndGetCollateParams()
 {
     $this->assertEquals($this->spellCheck, $this->spellCheck->setCollateParam('mm', '100%'));
     $params = $this->spellCheck->getCollateParams();
     $this->assertArrayHasKey('mm', $params);
     $this->assertEquals('100%', $params['mm']);
 }
示例#2
0
 /**
  * Add request settings for Spellcheck
  *
  * @param  SpellcheckComponent $component
  * @param  Request             $request
  * @return Request
  */
 public function buildComponent($component, $request)
 {
     // enable spellcheck
     $request->addParam('spellcheck', 'true');
     $request->addParam('spellcheck.q', $component->getQuery());
     $request->addParam('spellcheck.build', $component->getBuild());
     $request->addParam('spellcheck.reload', $component->getReload());
     $request->addParam('spellcheck.dictionary', $component->getDictionary());
     $request->addParam('spellcheck.count', $component->getCount());
     $request->addParam('spellcheck.onlyMorePopular', $component->getOnlyMorePopular());
     $request->addParam('spellcheck.extendedResults', $component->getExtendedResults());
     $request->addParam('spellcheck.collate', $component->getCollate());
     $request->addParam('spellcheck.maxCollations', $component->getMaxCollations());
     $request->addParam('spellcheck.maxCollationTries', $component->getMaxCollationTries());
     $request->addParam('spellcheck.maxCollationEvaluations', $component->getMaxCollationEvaluations());
     $request->addParam('spellcheck.collateExtendedResults', $component->getCollateExtendedResults());
     $request->addParam('spellcheck.accuracy', $component->getAccuracy());
     foreach ($component->getCollateParams() as $param => $value) {
         $request->addParam('spellcheck.collateParam.' . $param, $value);
     }
     return $request;
 }