_disMax = new Solarium_Query_Select_Component_DisMax; } public function testConfigMode() { $options = array( 'queryparser' => 'edismax', 'queryalternative' => '*:*', 'queryfields' => 'title^2.0 description', 'minimummatch' => '2.0', 'phrasefields' => 'title^2.0 description^3.5', 'phraseslop' => 2, 'queryphraseslop' => 4, 'tie' => 2.1, 'boostquery' => 'cat:1^3', 'boostfunctions' => 'funcA(arg1,arg2)^1.2 funcB(arg3,arg4)^2.2', ); $this->_disMax->setOptions($options); $this->assertEquals($options['queryparser'], $this->_disMax->getQueryParser()); $this->assertEquals($options['queryalternative'], $this->_disMax->getQueryAlternative()); $this->assertEquals($options['queryfields'], $this->_disMax->getQueryFields()); $this->assertEquals($options['minimummatch'], $this->_disMax->getMinimumMatch()); $this->assertEquals($options['phrasefields'], $this->_disMax->getPhraseFields()); $this->assertEquals($options['phraseslop'], $this->_disMax->getPhraseSlop()); $this->assertEquals($options['queryphraseslop'], $this->_disMax->getQueryPhraseSlop()); $this->assertEquals($options['tie'], $this->_disMax->getTie()); $this->assertEquals($options['boostquery'], $this->_disMax->getBoostQuery()); $this->assertEquals($options['boostfunctions'], $this->_disMax->getBoostFunctions()); } public function testGetType() { $this->assertEquals( Solarium_Query_Select::COMPONENT_DISMAX, $this->_disMax->getType() ); } public function testSetAndGetQueryParser() { $value = 'dummyparser'; $this->_disMax->setQueryParser($value); $this->assertEquals( $value, $this->_disMax->getQueryParser() ); } public function testSetAndGetQueryAlternative() { $value = '*:*'; $this->_disMax->setQueryAlternative($value); $this->assertEquals( $value, $this->_disMax->getQueryAlternative() ); } public function testSetAndGetQueryFields() { $value = 'title^2.0 description'; $this->_disMax->setQueryFields($value); $this->assertEquals( $value, $this->_disMax->getQueryFields() ); } public function testSetAndGetMinimumMatch() { $value = '2.0'; $this->_disMax->setMinimumMatch($value); $this->assertEquals( $value, $this->_disMax->getMinimumMatch() ); } public function testSetAndGetPhraseFields() { $value = 'title^2.0 description^3.5'; $this->_disMax->setPhraseFields($value); $this->assertEquals( $value, $this->_disMax->getPhraseFields() ); } public function testSetAndGetPhraseSlop() { $value = '2'; $this->_disMax->setPhraseSlop($value); $this->assertEquals( $value, $this->_disMax->getPhraseSlop() ); } public function testSetAndGetQueryPhraseSlop() { $value = '3'; $this->_disMax->setQueryPhraseSlop($value); $this->assertEquals( $value, $this->_disMax->getQueryPhraseSlop() ); } public function testSetAndGetTie() { $value = 2.1; $this->_disMax->setTie($value); $this->assertEquals( $value, $this->_disMax->getTie() ); } public function testSetAndGetBoostQuery() { $value = 'cat:1^3'; $this->_disMax->setBoostQuery($value); $this->assertEquals( $value, $this->_disMax->getBoostQuery() ); } public function testSetAndGetBoostFunctions() { $value = 'funcA(arg1,arg2)^1.2 funcB(arg3,arg4)^2.2'; $this->_disMax->setBoostFunctions($value); $this->assertEquals( $value, $this->_disMax->getBoostFunctions() ); } }