Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/thomascorthals/solarium
Browse files Browse the repository at this point in the history
…into thomascorthals-develop

# Conflicts:
#	library/Solarium/Core/Client/Adapter/Curl.php
#	library/Solarium/QueryType/Select/Query/Component/Facet/Field.php
#	library/Solarium/QueryType/Select/Query/Component/FacetSet.php
  • Loading branch information
basdenooijer committed Nov 30, 2015
2 parents 7757cb6 + 8f3bef0 commit c5377c3
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 3 deletions.
53 changes: 51 additions & 2 deletions library/Solarium/QueryType/Select/Query/Component/Facet/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,58 @@ public function getPrefix()
}

/**
* Set the facet limit.
* Limit the terms for faceting by a string they must contain
*
* @param int $limit
* This is a global value for all facets in this facetset
*
* @param string $contains
* @return self Provides fluent interface
*/
public function setContains($contains)
{
return $this->setOption('contains', $contains);
}

/**
* Get the facet contains
*
* This is a global value for all facets in this facetset
*
* @return string
*/
public function getContains()
{
return $this->getOption('contains');
}


/**
* Case sensitivity of matching string that facet terms must contain
*
* This is a global value for all facets in this facetset
*
* @param boolean $containsIgnoreCase
* @return self Provides fluent interface
*/
public function setContainsIgnoreCase($containsIgnoreCase)
{
return $this->setOption('contains.ignoreCase', $containsIgnoreCase);
}

/**
* Get the case sensitivity of facet contains
*
* This is a global value for all facets in this facetset
*
* @return boolean
*/
public function getContainsIgnoreCase()
{
return $this->getOption('contains.ignoreCase');
}

/**
* Set the facet limit
*
* @return self Provides fluent interface
*/
Expand Down
53 changes: 52 additions & 1 deletion library/Solarium/QueryType/Select/Query/Component/FacetSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,58 @@ public function getPrefix()
}

/**
* Set the facet sort order.
* Limit the terms for faceting by a string they must contain
*
* This is a global value for all facets in this facetset
*
* @param string $contains
* @return self Provides fluent interface
*/
public function setContains($contains)
{
return $this->setOption('contains', $contains);
}

/**
* Get the facet contains
*
* This is a global value for all facets in this facetset
*
* @return string
*/
public function getContains()
{
return $this->getOption('contains');
}


/**
* Case sensitivity of matching string that facet terms must contain
*
* This is a global value for all facets in this facetset
*
* @param boolean $containsIgnoreCase
* @return self Provides fluent interface
*/
public function setContainsIgnoreCase($containsIgnoreCase)
{
return $this->setOption('contains.ignoreCase', $containsIgnoreCase);
}

/**
* Get the case sensitivity of facet contains
*
* This is a global value for all facets in this facetset
*
* @return boolean
*/
public function getContainsIgnoreCase()
{
return $this->getOption('contains.ignoreCase');
}

/**
* Set the facet sort order
*
* Use one of the SORT_* constants as the value
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public function buildComponent($component, $request)
// global facet params
$request->addParam('facet.sort', $component->getSort());
$request->addParam('facet.prefix', $component->getPrefix());
$request->addParam('facet.contains', $component->getContains());
$request->addParam('facet.contains.ignoreCase', is_null($ignoreCase = $component->getContainsIgnoreCase()) ? null : ($ignoreCase ? 'true' : 'false'));
$request->addParam('facet.missing', $component->getMissing());
$request->addParam('facet.mincount', $component->getMinCount());
$request->addParam('facet.limit', $component->getLimit());
Expand Down Expand Up @@ -130,6 +132,8 @@ public function addFacetField($request, $facet)
$request->addParam("f.$field.facet.limit", $facet->getLimit());
$request->addParam("f.$field.facet.sort", $facet->getSort());
$request->addParam("f.$field.facet.prefix", $facet->getPrefix());
$request->addParam("f.$field.facet.contains", $facet->getContains());
$request->addParam("f.$field.facet.contains.ignoreCase", is_null($ignoreCase = $facet->getContainsIgnoreCase()) ? null : ($ignoreCase ? 'true' : 'false'));
$request->addParam("f.$field.facet.offset", $facet->getOffset());
$request->addParam("f.$field.facet.mincount", $facet->getMinCount());
$request->addParam("f.$field.facet.missing", $facet->getMissing());
Expand Down

0 comments on commit c5377c3

Please sign in to comment.