FacetFilter method: FacetFilter class
Syntax
FacetFilter(FacetName, Path)
Description
Use this constructor to instantiate a FacetFilter object for a specific facet to indicate the facet and path.
Parameters
| Parameter | Description |
|---|---|
|
FacetName |
Specifies the name of the facet as a string. |
|
Path |
Specifies the value of the facet as a string. |
Returns
A FacetFilter object.
Example
The following examples demonstrate four ways to create a facet filter:
-
Use the SearchCategory class to return the initial list of facet filters with empty paths as an array of FacetFilter objects:
Local PT_SEARCH:SearchCategory &srchCat = create PT_SEARCH:SearchCategory⇒ ("MY_SRCH_CAT"); &qry.Categories = CreateArray(&srchCat); &qry.FacetFilters = &srchCat.GetFacetFilters(); -
When requesting a specific facet for the first time, specify an empty string for the path:
Local PT_SEARCH:FacetFilter &facetFilter = create PT_SEARCH:FacetFilter("LOCATION",⇒ "") -
When the facet is hierarchical, specify the hierarchy in the path. For example, the LOCATION facet could have a hierarchy of country/state/city. To filter by country, use the following filter:
Local PT_SEARCH:FacetFilter &facetFilter = create PT_SEARCH:FacetFilter⇒ ("LOCATION","USA") -
To filter by state, use the following filter:
Local PT_SEARCH:FacetFilter &facetFilter = create PT_SEARCH:FacetFilter⇒ ("LOCATION","USA/CA")
Related Topics