Skip to content

Commit

Permalink
Fix for incompatible build method (issue solariumphp#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
basdenooijer committed Jan 18, 2012
1 parent 47db7e2 commit 977c0a7
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion library/Solarium/Client/RequestBuilder/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
*/
class Solarium_Client_RequestBuilder_Select_Component_DisMax
{

/**
* Add request settings for Dismax
*
* @param Solarium_Query_Select_Component_Dismax $component
* @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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
*/
class Solarium_Client_RequestBuilder_Select_Component_FacetSet extends Solarium_Client_RequestBuilder
{

/**
* Add request settings for FacetSet
*
* @param Solarium_Query_Select_Component_FacetSet $component
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
*/
class Solarium_Client_RequestBuilder_Select_Component_MoreLikeThis
{

/**
* Add request settings for morelikethis
*
* @param Solarium_Query_Select_Component_MoreLikeThis $component
* @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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
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();

$component = new Solarium_Query_Select_Component_Debug();
$component->setExplainOther('id:45');

$request = $builder->build($component, $request);
$request = $builder->buildComponent($component, $request);

$this->assertEquals(
array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -45,7 +45,7 @@ public function testBuild()
));
$component->setShardRequestHandler('dummy');

$request = $builder->build($component, $request);
$request = $builder->buildComponent($component, $request);

$this->assertEquals(
array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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(
Expand Down

0 comments on commit 977c0a7

Please sign in to comment.