Skip to content

Commit

Permalink
Merge branch 'master' into increase_test_coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Kalkbrenner committed May 11, 2018
2 parents 01ae6b0 + cb0f6ee commit f39ee3d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 31 deletions.
@@ -1,4 +1,4 @@
This facet type allows you to count the number of occurences of a term in a specific field.
This facet type allows you to count the number of occurrences of a term in a specific field.

Options
-------
Expand All @@ -7,15 +7,18 @@ The options below can be set as query option values, but also by using the set/g

Only the facet-type specific options are listed. See [Facetset component](V3:Facetset_component "wikilink") for the option shared by all facet types.

| Name | Type | Default value | Description |
|----------|---------|---------------|----------------------------------------------------------------------------------------------------------------------------|
| field | string | null | The index field for the facet. |
| sort | string | null | Sort order (sorted by count). Use one of the class constants. |
| limit | int | null | Limit the facet counts |
| offset | int | null | Show facet count starting from this offset |
| mincount | int | null | Minimal term count to be included in facet count results. |
| missing | boolean | null | Also make a count of all document that have no value for the facet field. |
| method | string | null | Use one of the class constants as value. See <http://wiki.apache.org/solr/SimpleFacetParameters#facet.method> for details. |
| Name | Type | Default value | Description |
|--------------------|---------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| field | string | null | The index field for the facet. |
| prefix | string | null | Limit the terms on which to facet to those starting with the given prefix. This does not limit the query, only the facets. |
| contains | string | null | Limit the terms on which to facet to those containing the given substring. This does not limit the query, only the facets. Available since Solr 5.1. |
| containsignorecase | boolean | null | If 'contains' is used, causes case to be ignored when matching the given substring against candidate facet terms. |
| sort | string | null | Sort order (sorted by count). Use one of the class constants. |
| limit | int | null | Limit the facet counts. |
| offset | int | null | Show facet count starting from this offset. |
| mincount | int | null | Minimal term count to be included in facet count results. |
| missing | boolean | null | Also make a count of all document that have no value for the facet field. |
| method | string | null | Use one of the class constants as value. See <http://wiki.apache.org/solr/SimpleFacetParameters#facet.method> for details. |
||

Example
Expand Down
@@ -1,17 +1,19 @@
The concept of a 'facetset' is doesn't exist in Solr. It was added to Solarium to have one central component for using facets of various type. You can use the facetset to create and manage facets, and also to set global facet options.
The concept of a 'facetset' doesn't exist in Solr. It was added to Solarium to have one central component for using facets of various type. You can use the facetset to create and manage facets, and also to set global facet options.

See the API docs for all methods. In the following sections facet types will be detailed. The examples used on those pages will also show the usage of the facetset component.

Global facet options
--------------------

| Name | Type | Default value | Description |
|----------|---------|---------------|------------------------------------------|
| prefix | string | null | Limit the terms for faceting by a prefix |
| sort | string | null | Set the facet sort order |
| limit | int | null | Set the facet limit |
| mincount | int | null | Set the facet mincount |
| missing | boolean | null | Set the 'count missing' option |
| Name | Type | Default value | Description |
|--------------------|---------|---------------|------------------------------------------------------------------------|
| prefix | string | null | Limit the terms for faceting by a prefix |
| contains | string | null | Limit the terms for faceting by a substring (available since Solr 5.1) |
| containsignorecase | boolean | null | Causes case to be ignored for 'contains' |
| sort | string | null | Set the facet sort order |
| limit | int | null | Set the facet limit |
| mincount | int | null | Set the facet mincount |
| missing | boolean | null | Set the 'count missing' option |
||

Standard facet options
Expand Down
12 changes: 2 additions & 10 deletions src/Component/Facet/Field.php
Expand Up @@ -34,9 +34,7 @@ public function getType()
}

/**
* Limit the terms for faceting by a string they must contain.
*
* This is a global value for all facets in this facetset
* Limit the terms for faceting by a string they must contain. Since Solr 5.1.
*
* @param string $contains
*
Expand All @@ -50,8 +48,6 @@ public function setContains($contains)
/**
* Get the facet contains.
*
* This is a global value for all facets in this facetset
*
* @return string
*/
public function getContains()
Expand All @@ -60,9 +56,7 @@ public function getContains()
}

/**
* Case sensitivity of matching string that facet terms must contain.
*
* This is a global value for all facets in this facetset
* Case sensitivity of matching string that facet terms must contain. Since Solr 5.1.
*
* @param bool $containsIgnoreCase
*
Expand All @@ -76,8 +70,6 @@ public function setContainsIgnoreCase($containsIgnoreCase)
/**
* Get the case sensitivity of facet contains.
*
* This is a global value for all facets in this facetset
*
* @return bool
*/
public function getContainsIgnoreCase()
Expand Down
4 changes: 2 additions & 2 deletions src/Component/FacetSet.php
Expand Up @@ -118,7 +118,7 @@ public function getPrefix()
}

/**
* Limit the terms for faceting by a string they must contain.
* Limit the terms for faceting by a string they must contain. Since Solr 5.1.
*
* This is a global value for all facets in this facetset
*
Expand All @@ -144,7 +144,7 @@ public function getContains()
}

/**
* Case sensitivity of matching string that facet terms must contain.
* Case sensitivity of matching string that facet terms must contain. Since Solr 5.1.
*
* This is a global value for all facets in this facetset
*
Expand Down
2 changes: 1 addition & 1 deletion src/Component/RequestBuilder/FacetSet.php
Expand Up @@ -125,7 +125,7 @@ public function addFacetField($request, $facet)
$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", null === ($ignoreCase = $facet->getContainsIgnoreCase()) ? null : ($ignoreCase ? 'true' : 'false'));
$request->addParam("f.$field.facet.contains.ignoreCase", $facet->getContainsIgnoreCase());
$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 f39ee3d

Please sign in to comment.