public function testSetAndGetAccuracy()
 {
     $value = 0.1;
     $this->_spellCheck->setAccuracy($value);
     $this->assertEquals($value, $this->_spellCheck->getAccuracy());
 }
Exemplo n.º 2
0
 /**
  * Add request settings for Spellcheck
  *
  * @param Solarium_Query_Select_Component_Spellcheck $component
  * @param Solarium_Client_Request $request
  * @return Solarium_Client_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());
     return $request;
 }
 public function testBuild()
 {
     $builder = new Solarium_Client_RequestBuilder_Select_Component_Spellcheck();
     $request = new Solarium_Client_Request();
     $component = new Solarium_Query_Select_Component_Spellcheck();
     $component->setQuery('testquery');
     $component->setBuild(false);
     $component->setReload(true);
     $component->setDictionary('testdict');
     $component->setCount(3);
     $component->setOnlyMorePopular(false);
     $component->setExtendedResults(true);
     $component->setCollate(true);
     $component->setMaxCollations(2);
     $component->setMaxCollationTries(4);
     $component->setMaxCollationEvaluations(4);
     $component->setCollateExtendedResults(true);
     $component->setAccuracy(0.2);
     $request = $builder->build($component, $request);
     $this->assertEquals(array('spellcheck' => 'true', 'spellcheck.q' => 'testquery', 'spellcheck.build' => 'false', 'spellcheck.reload' => 'true', 'spellcheck.dictionary' => 'testdict', 'spellcheck.count' => 3, 'spellcheck.onlyMorePopular' => 'false', 'spellcheck.extendedResults' => 'true', 'spellcheck.collate' => 'true', 'spellcheck.maxCollations' => 2, 'spellcheck.maxCollationTries' => 4, 'spellcheck.maxCollationEvaluations' => 4, 'spellcheck.collateExtendedResults' => 'true', 'spellcheck.accuracy' => 0.2), $request->getParams());
 }