示例#1
0
 public function testBuild()
 {
     $builder = new Solarium_Client_RequestBuilder_Select_Component_DisMax();
     $request = new Solarium_Client_Request();
     $component = new Solarium_Query_Select_Component_DisMax();
     $component->setQueryAlternative('test');
     $component->setQueryFields('content,name');
     $component->setMinimumMatch('75%');
     $component->setPhraseFields('content,description');
     $component->setPhraseSlop(1);
     $component->setQueryPhraseSlop(2);
     $component->setTie(0.5);
     $component->setBoostQuery('cat:1');
     $component->setBoostFunctions('functionX(price)');
     $request = $builder->build($component, $request);
     $this->assertEquals(array('defType' => 'dismax', 'q.alt' => 'test', 'qf' => 'content,name', 'mm' => '75%', 'pf' => 'content,description', 'ps' => 1, 'qs' => 2, 'tie' => 0.5, 'bq' => 'cat:1', 'bf' => 'functionX(price)'), $request->getParams());
 }
示例#2
0
 public function testSetAndGetQueryAlternative()
 {
     $value = '*:*';
     $this->_disMax->setQueryAlternative($value);
     $this->assertEquals($value, $this->_disMax->getQueryAlternative());
 }