From 977c0a7034bd0796bcd39a50a720737c0533299f Mon Sep 17 00:00:00 2001 From: Bas de Nooijer Date: Wed, 18 Jan 2012 07:27:30 +0100 Subject: [PATCH] Fix for incompatible build method (issue #65) --- library/Solarium/Client/RequestBuilder/Select.php | 2 +- .../Client/RequestBuilder/Select/Component/Debug.php | 2 +- .../RequestBuilder/Select/Component/DisMax.php | 4 ++-- .../Select/Component/DistributedSearch.php | 2 +- .../RequestBuilder/Select/Component/FacetSet.php | 4 ++-- .../RequestBuilder/Select/Component/Grouping.php | 2 +- .../RequestBuilder/Select/Component/Highlighting.php | 2 +- .../RequestBuilder/Select/Component/MoreLikeThis.php | 4 ++-- .../RequestBuilder/Select/Component/Spellcheck.php | 2 +- .../Client/RequestBuilder/Select/Component/Stats.php | 2 +- .../RequestBuilder/Select/Component/DebugTest.php | 4 ++-- .../RequestBuilder/Select/Component/DisMaxTest.php | 8 ++++---- .../Select/Component/DistributedSearchTest.php | 4 ++-- .../RequestBuilder/Select/Component/FacetSetTest.php | 12 ++++++------ .../RequestBuilder/Select/Component/GroupingTest.php | 4 ++-- .../Select/Component/HighlightingTest.php | 4 ++-- .../Select/Component/MoreLikeThisTest.php | 8 ++++---- .../Select/Component/SpellcheckTest.php | 4 ++-- .../RequestBuilder/Select/Component/StatsTest.php | 4 ++-- 19 files changed, 39 insertions(+), 39 deletions(-) diff --git a/library/Solarium/Client/RequestBuilder/Select.php b/library/Solarium/Client/RequestBuilder/Select.php index bc7be662f..bd627d530 100644 --- a/library/Solarium/Client/RequestBuilder/Select.php +++ b/library/Solarium/Client/RequestBuilder/Select.php @@ -90,7 +90,7 @@ public function build($query) $componentBuilderClass = $types[$component->getType()]['requestbuilder']; if (!empty($componentBuilderClass)) { $componentBuilder = new $componentBuilderClass; - $request = $componentBuilder->build($component, $request); + $request = $componentBuilder->buildComponent($component, $request); } } diff --git a/library/Solarium/Client/RequestBuilder/Select/Component/Debug.php b/library/Solarium/Client/RequestBuilder/Select/Component/Debug.php index 00e2f64e3..a837d3a37 100644 --- a/library/Solarium/Client/RequestBuilder/Select/Component/Debug.php +++ b/library/Solarium/Client/RequestBuilder/Select/Component/Debug.php @@ -52,7 +52,7 @@ class Solarium_Client_RequestBuilder_Select_Component_Debug * @param Solarium_Client_Request $request * @return Solarium_Client_Request */ - public function build($component, $request) + public function buildComponent($component, $request) { $request->addParam('debugQuery', 'true'); $request->addParam('debug.explain.structured', 'true'); diff --git a/library/Solarium/Client/RequestBuilder/Select/Component/DisMax.php b/library/Solarium/Client/RequestBuilder/Select/Component/DisMax.php index 4c9ded9fd..01885c11d 100644 --- a/library/Solarium/Client/RequestBuilder/Select/Component/DisMax.php +++ b/library/Solarium/Client/RequestBuilder/Select/Component/DisMax.php @@ -44,7 +44,7 @@ */ class Solarium_Client_RequestBuilder_Select_Component_DisMax { - + /** * Add request settings for Dismax * @@ -52,7 +52,7 @@ class Solarium_Client_RequestBuilder_Select_Component_DisMax * @param Solarium_Client_Request $request * @return Solarium_Client_Request */ - public function build($component, $request) + public function buildComponent($component, $request) { // enable dismax $request->addParam('defType', $component->getQueryParser()); diff --git a/library/Solarium/Client/RequestBuilder/Select/Component/DistributedSearch.php b/library/Solarium/Client/RequestBuilder/Select/Component/DistributedSearch.php index b44f6966f..6ea6f22f2 100644 --- a/library/Solarium/Client/RequestBuilder/Select/Component/DistributedSearch.php +++ b/library/Solarium/Client/RequestBuilder/Select/Component/DistributedSearch.php @@ -52,7 +52,7 @@ class Solarium_Client_RequestBuilder_Select_Component_DistributedSearch * @param Solarium_Client_Request $request * @return Solarium_Client_Request */ - public function build($component, $request) + public function buildComponent($component, $request) { // add shard fields to request $shards = array_values($component->getShards()); diff --git a/library/Solarium/Client/RequestBuilder/Select/Component/FacetSet.php b/library/Solarium/Client/RequestBuilder/Select/Component/FacetSet.php index c4dc85f06..9ce1e34d6 100644 --- a/library/Solarium/Client/RequestBuilder/Select/Component/FacetSet.php +++ b/library/Solarium/Client/RequestBuilder/Select/Component/FacetSet.php @@ -44,7 +44,7 @@ */ class Solarium_Client_RequestBuilder_Select_Component_FacetSet extends Solarium_Client_RequestBuilder { - + /** * Add request settings for FacetSet * @@ -52,7 +52,7 @@ class Solarium_Client_RequestBuilder_Select_Component_FacetSet extends Solarium_ * @param Solarium_Client_Request $request * @return Solarium_Client_Request */ - public function build($component, $request) + public function buildComponent($component, $request) { $facets = $component->getFacets(); if (count($facets) !== 0) { diff --git a/library/Solarium/Client/RequestBuilder/Select/Component/Grouping.php b/library/Solarium/Client/RequestBuilder/Select/Component/Grouping.php index 3110d462b..b48259db7 100644 --- a/library/Solarium/Client/RequestBuilder/Select/Component/Grouping.php +++ b/library/Solarium/Client/RequestBuilder/Select/Component/Grouping.php @@ -52,7 +52,7 @@ class Solarium_Client_RequestBuilder_Select_Component_Grouping * @param Solarium_Client_Request $request * @return Solarium_Client_Request */ - public function build($component, $request) + public function buildComponent($component, $request) { // enable grouping $request->addParam('group', 'true'); diff --git a/library/Solarium/Client/RequestBuilder/Select/Component/Highlighting.php b/library/Solarium/Client/RequestBuilder/Select/Component/Highlighting.php index 3304ab830..582f2bb3c 100644 --- a/library/Solarium/Client/RequestBuilder/Select/Component/Highlighting.php +++ b/library/Solarium/Client/RequestBuilder/Select/Component/Highlighting.php @@ -52,7 +52,7 @@ class Solarium_Client_RequestBuilder_Select_Component_Highlighting * @param Solarium_Client_Request $request * @return Solarium_Client_Request */ - public function build(Solarium_Query_Select_Component_Highlighting $component, Solarium_Client_Request $request) + public function buildComponent(Solarium_Query_Select_Component_Highlighting $component, Solarium_Client_Request $request) { // enable highlighting $request->addParam('hl', 'true'); diff --git a/library/Solarium/Client/RequestBuilder/Select/Component/MoreLikeThis.php b/library/Solarium/Client/RequestBuilder/Select/Component/MoreLikeThis.php index b46dd661c..2e76dc5fd 100644 --- a/library/Solarium/Client/RequestBuilder/Select/Component/MoreLikeThis.php +++ b/library/Solarium/Client/RequestBuilder/Select/Component/MoreLikeThis.php @@ -44,7 +44,7 @@ */ class Solarium_Client_RequestBuilder_Select_Component_MoreLikeThis { - + /** * Add request settings for morelikethis * @@ -52,7 +52,7 @@ class Solarium_Client_RequestBuilder_Select_Component_MoreLikeThis * @param Solarium_Client_Request $request * @return Solarium_Client_Request */ - public function build($component, $request) + public function buildComponent($component, $request) { // enable morelikethis $request->addParam('mlt', 'true'); diff --git a/library/Solarium/Client/RequestBuilder/Select/Component/Spellcheck.php b/library/Solarium/Client/RequestBuilder/Select/Component/Spellcheck.php index 15e46c197..841cede51 100644 --- a/library/Solarium/Client/RequestBuilder/Select/Component/Spellcheck.php +++ b/library/Solarium/Client/RequestBuilder/Select/Component/Spellcheck.php @@ -52,7 +52,7 @@ class Solarium_Client_RequestBuilder_Select_Component_Spellcheck * @param Solarium_Client_Request $request * @return Solarium_Client_Request */ - public function build($component, $request) + public function buildComponent($component, $request) { // enable spellcheck $request->addParam('spellcheck', 'true'); diff --git a/library/Solarium/Client/RequestBuilder/Select/Component/Stats.php b/library/Solarium/Client/RequestBuilder/Select/Component/Stats.php index 4fbcf9594..bac899614 100644 --- a/library/Solarium/Client/RequestBuilder/Select/Component/Stats.php +++ b/library/Solarium/Client/RequestBuilder/Select/Component/Stats.php @@ -52,7 +52,7 @@ class Solarium_Client_RequestBuilder_Select_Component_Stats * @param Solarium_Client_Request $request * @return Solarium_Client_Request */ - public function build($component, $request) + public function buildComponent($component, $request) { // enable stats $request->addParam('stats', 'true'); diff --git a/tests/Solarium/Client/RequestBuilder/Select/Component/DebugTest.php b/tests/Solarium/Client/RequestBuilder/Select/Component/DebugTest.php index da4f2f917..dcdafb127 100644 --- a/tests/Solarium/Client/RequestBuilder/Select/Component/DebugTest.php +++ b/tests/Solarium/Client/RequestBuilder/Select/Component/DebugTest.php @@ -32,7 +32,7 @@ class Solarium_Client_RequestBuilder_Select_Component_DebugTest extends PHPUnit_Framework_TestCase { - public function testBuild() + public function testBuildComponent() { $builder = new Solarium_Client_RequestBuilder_Select_Component_Debug(); $request = new Solarium_Client_Request(); @@ -40,7 +40,7 @@ public function testBuild() $component = new Solarium_Query_Select_Component_Debug(); $component->setExplainOther('id:45'); - $request = $builder->build($component, $request); + $request = $builder->buildComponent($component, $request); $this->assertEquals( array( diff --git a/tests/Solarium/Client/RequestBuilder/Select/Component/DisMaxTest.php b/tests/Solarium/Client/RequestBuilder/Select/Component/DisMaxTest.php index b7511c276..62d71b7bd 100644 --- a/tests/Solarium/Client/RequestBuilder/Select/Component/DisMaxTest.php +++ b/tests/Solarium/Client/RequestBuilder/Select/Component/DisMaxTest.php @@ -32,7 +32,7 @@ class Solarium_Client_RequestBuilder_Select_Component_DisMaxTest extends PHPUnit_Framework_TestCase { - public function testBuild() + public function testBuildComponent() { $builder = new Solarium_Client_RequestBuilder_Select_Component_DisMax; $request = new Solarium_Client_Request(); @@ -48,9 +48,9 @@ public function testBuild() $component->setTie(0.5); $component->setBoostQuery('cat:1'); $component->setBoostFunctions('functionX(price)'); - - $request = $builder->build($component, $request); - + + $request = $builder->buildComponent($component, $request); + $this->assertEquals( array( 'defType' => 'dummyparser', diff --git a/tests/Solarium/Client/RequestBuilder/Select/Component/DistributedSearchTest.php b/tests/Solarium/Client/RequestBuilder/Select/Component/DistributedSearchTest.php index dd3240ce6..86ff1eb6f 100644 --- a/tests/Solarium/Client/RequestBuilder/Select/Component/DistributedSearchTest.php +++ b/tests/Solarium/Client/RequestBuilder/Select/Component/DistributedSearchTest.php @@ -32,7 +32,7 @@ class Solarium_Client_RequestBuilder_Select_Component_DistributedSearchTest extends PHPUnit_Framework_TestCase { - public function testBuild() + public function testBuildComponent() { $builder = new Solarium_Client_RequestBuilder_Select_Component_DistributedSearch; $request = new Solarium_Client_Request(); @@ -45,7 +45,7 @@ public function testBuild() )); $component->setShardRequestHandler('dummy'); - $request = $builder->build($component, $request); + $request = $builder->buildComponent($component, $request); $this->assertEquals( array( diff --git a/tests/Solarium/Client/RequestBuilder/Select/Component/FacetSetTest.php b/tests/Solarium/Client/RequestBuilder/Select/Component/FacetSetTest.php index d010420a1..ca15b6440 100644 --- a/tests/Solarium/Client/RequestBuilder/Select/Component/FacetSetTest.php +++ b/tests/Solarium/Client/RequestBuilder/Select/Component/FacetSetTest.php @@ -57,8 +57,8 @@ public function setUp() public function testBuildEmptyFacetSet() { - $request = $this->_builder->build($this->_component, $this->_request); - + $request = $this->_builder->buildComponent($this->_component, $this->_request); + $this->assertEquals( array(), $request->getParams() @@ -71,7 +71,7 @@ public function testBuildWithFacets() $this->_component->addFacet(new Solarium_Query_Select_Component_Facet_Field(array('key' => 'f1', 'field' => 'owner'))); $this->_component->addFacet(new Solarium_Query_Select_Component_Facet_Query(array('key' => 'f2', 'query' => 'category:23'))); $this->_component->addFacet(new Solarium_Query_Select_Component_Facet_MultiQuery(array('key' => 'f3', 'query' => array('f4' => array('query' => 'category:40'))))); - $request = $this->_builder->build($this->_component, $this->_request); + $request = $this->_builder->buildComponent($this->_component, $this->_request); $this->assertEquals( null, @@ -98,7 +98,7 @@ public function testBuildWithRangeFacet() ) )); - $request = $this->_builder->build($this->_component, $this->_request); + $request = $this->_builder->buildComponent($this->_component, $this->_request); $this->assertEquals( null, @@ -118,7 +118,7 @@ public function testBuildWithFacetsAndGlobalFacetSettings() $this->_component->addFacet(new Solarium_Query_Select_Component_Facet_Field(array('key' => 'f1', 'field' => 'owner'))); $this->_component->addFacet(new Solarium_Query_Select_Component_Facet_Query(array('key' => 'f2', 'query' => 'category:23'))); $this->_component->addFacet(new Solarium_Query_Select_Component_Facet_MultiQuery(array('key' => 'f3', 'query' => array('f4' =>array('query' => 'category:40'))))); - $request = $this->_builder->build($this->_component, $this->_request); + $request = $this->_builder->buildComponent($this->_component, $this->_request); $this->assertEquals( null, @@ -135,7 +135,7 @@ public function testBuildUnknownFacetType() { $this->_component->addFacet(new UnknownFacet(array('key' => 'f1', 'field' => 'owner'))); $this->setExpectedException('Solarium_Exception'); - $request = $this->_builder->build($this->_component, $this->_request); + $request = $this->_builder->buildComponent($this->_component, $this->_request); $request->getUri(); } diff --git a/tests/Solarium/Client/RequestBuilder/Select/Component/GroupingTest.php b/tests/Solarium/Client/RequestBuilder/Select/Component/GroupingTest.php index 4dfd5e982..f8a2dc459 100644 --- a/tests/Solarium/Client/RequestBuilder/Select/Component/GroupingTest.php +++ b/tests/Solarium/Client/RequestBuilder/Select/Component/GroupingTest.php @@ -32,7 +32,7 @@ class Solarium_Client_RequestBuilder_Select_Component_GroupingTest extends PHPUnit_Framework_TestCase { - public function testBuild() + public function testBuildComponent() { $builder = new Solarium_Client_RequestBuilder_Select_Component_Grouping; $request = new Solarium_Client_Request(); @@ -48,7 +48,7 @@ public function testBuild() $component->setCachePercentage(50); $component->setTruncate(true); - $request = $builder->build($component, $request); + $request = $builder->buildComponent($component, $request); $this->assertEquals( array( diff --git a/tests/Solarium/Client/RequestBuilder/Select/Component/HighlightingTest.php b/tests/Solarium/Client/RequestBuilder/Select/Component/HighlightingTest.php index 2334e5959..c6eff801d 100644 --- a/tests/Solarium/Client/RequestBuilder/Select/Component/HighlightingTest.php +++ b/tests/Solarium/Client/RequestBuilder/Select/Component/HighlightingTest.php @@ -32,7 +32,7 @@ class Solarium_Client_RequestBuilder_Select_Component_HighlightingTest extends PHPUnit_Framework_TestCase { - public function testBuild() + public function testBuildComponent() { $builder = new Solarium_Client_RequestBuilder_Select_Component_Highlighting; $request = new Solarium_Client_Request(); @@ -73,7 +73,7 @@ public function testBuild() $component->setQuery('text:myvalue'); $component->setPhraseLimit(40); - $request = $builder->build($component, $request); + $request = $builder->buildComponent($component, $request); $this->assertEquals( array( diff --git a/tests/Solarium/Client/RequestBuilder/Select/Component/MoreLikeThisTest.php b/tests/Solarium/Client/RequestBuilder/Select/Component/MoreLikeThisTest.php index cd4a5a744..4d2cf2a0f 100644 --- a/tests/Solarium/Client/RequestBuilder/Select/Component/MoreLikeThisTest.php +++ b/tests/Solarium/Client/RequestBuilder/Select/Component/MoreLikeThisTest.php @@ -32,7 +32,7 @@ class Solarium_Client_RequestBuilder_Select_Component_MoreLikeThisTest extends PHPUnit_Framework_TestCase { - public function testBuild() + public function testBuildComponent() { $builder = new Solarium_Client_RequestBuilder_Select_Component_MoreLikeThis; $request = new Solarium_Client_Request(); @@ -48,9 +48,9 @@ public function testBuild() $component->setBoost(true); $component->setQueryFields('description'); $component->setCount(6); - - $request = $builder->build($component, $request); - + + $request = $builder->buildComponent($component, $request); + $this->assertEquals( array( 'mlt' => 'true', diff --git a/tests/Solarium/Client/RequestBuilder/Select/Component/SpellcheckTest.php b/tests/Solarium/Client/RequestBuilder/Select/Component/SpellcheckTest.php index 5c4931ffb..93a64fd2e 100644 --- a/tests/Solarium/Client/RequestBuilder/Select/Component/SpellcheckTest.php +++ b/tests/Solarium/Client/RequestBuilder/Select/Component/SpellcheckTest.php @@ -32,7 +32,7 @@ class Solarium_Client_RequestBuilder_Select_Component_SpellcheckTest extends PHPUnit_Framework_TestCase { - public function testBuild() + public function testBuildComponent() { $builder = new Solarium_Client_RequestBuilder_Select_Component_Spellcheck(); $request = new Solarium_Client_Request(); @@ -52,7 +52,7 @@ public function testBuild() $component->setCollateExtendedResults(true); $component->setAccuracy(.2); - $request = $builder->build($component, $request); + $request = $builder->buildComponent($component, $request); $this->assertEquals( array( diff --git a/tests/Solarium/Client/RequestBuilder/Select/Component/StatsTest.php b/tests/Solarium/Client/RequestBuilder/Select/Component/StatsTest.php index 88b68fc34..71bdf548b 100644 --- a/tests/Solarium/Client/RequestBuilder/Select/Component/StatsTest.php +++ b/tests/Solarium/Client/RequestBuilder/Select/Component/StatsTest.php @@ -32,7 +32,7 @@ class Solarium_Client_RequestBuilder_Select_Component_StatsTest extends PHPUnit_Framework_TestCase { - public function testBuild() + public function testBuildComponent() { $builder = new Solarium_Client_RequestBuilder_Select_Component_Stats(); $request = new Solarium_Client_Request(); @@ -42,7 +42,7 @@ public function testBuild() $component->createField('fieldB'); $component->addFacets(array('facetA', 'facetB')); - $request = $builder->build($component, $request); + $request = $builder->buildComponent($component, $request); $this->assertEquals( array(