Commit 2b5354f7 authored by Bas de Nooijer's avatar Bas de Nooijer

Merge branch 'fix-range-mincount' of github.com:FredM/solarium (PR #238) into develop

Conflicts:
	tests/Solarium/Tests/QueryType/Select/RequestBuilder/Component/FacetSetTest.php
parents 4b8af1c8 1a7a91a7
......@@ -310,4 +310,26 @@ class Range extends Facet
return $include;
}
/**
* Set the facet mincount
*
* @param int $minCount
* @return self Provides fluent interface
*/
public function setMinCount($minCount)
{
return $this->setOption('mincount', $minCount);
}
/**
* Get the facet mincount
*
* @return int
*/
public function getMinCount()
{
return $this->getOption('mincount');
}
}
......@@ -185,6 +185,7 @@ class FacetSet extends RequestBuilder implements ComponentRequestBuilderInterfac
$request->addParam("f.$field.facet.range.end", $facet->getEnd());
$request->addParam("f.$field.facet.range.gap", $facet->getGap());
$request->addParam("f.$field.facet.range.hardend", $facet->getHardend());
$request->addParam("f.$field.facet.mincount", $facet->getMinCount());
foreach ($facet->getOther() as $otherValue) {
$request->addParam("f.$field.facet.range.other", $otherValue);
......
......@@ -98,17 +98,16 @@ class FacetSetTest extends \PHPUnit_Framework_TestCase
public function testBuildWithRangeFacet()
{
$this->component->addFacet(
new FacetRange(
array(
'key' => 'f1',
'field' => 'price',
'start' => '1',
'end' => 100,
'gap' => 10,
'other' => 'all',
'include' => 'outer',
)
$this->component->addFacet(new FacetRange(
array(
'key' => 'f1',
'field' => 'price',
'start' => '1',
'end' => 100,
'gap' => 10,
'other' => 'all',
'include' => 'outer',
'mincount' => 123
)
);
......@@ -120,8 +119,7 @@ class FacetSetTest extends \PHPUnit_Framework_TestCase
);
$this->assertEquals(
'?facet=true&facet.range={!key=f1}price&f.price.facet.range.start=1&f.price.facet.range.end=100'.
'&f.price.facet.range.gap=10&f.price.facet.range.other=all&f.price.facet.range.include=outer',
'?facet=true&facet.range={!key=f1}price&f.price.facet.range.start=1&f.price.facet.range.end=100&f.price.facet.range.gap=10&f.price.facet.mincount=123&f.price.facet.range.other=all&f.price.facet.range.include=outer',
urldecode($request->getUri())
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment