Faceted Filtering
You can narrow the facet values returned in facetResults by prefix. This is useful for type-ahead filter pickers. To filter the buckets of one sourceName, set the facetBucketFilter object in requestOptions. It has two fields:
facet- The facet fieldName that you want to filter on.prefix- The prefix by which you want to filter the buckets of that facet by.
Include FACET_RESULTS in responseHints. This request filters the type buckets by the prefix co:
{
"query": "test",
"requestOptions": {
"facetBucketFilter": {
"facet": "type",
"prefix": "co"
},
"facetBucketSize": 3000,
"responseHints": ["FACET_RESULTS"]
}
}
Within the facetResults field in the response to this query, you will find that the bucket for sourceName="type" contains only those values with the prefix "co" in any word.
The required facetBucketSize sets the maximum number of buckets returned for each sourceName. The example above allows 3000.
To find which facets a datasource supports, see Datasource Filters. Platform API users get query-specific filter suggestions from List search filters; see the Search with discovered filters recipe.
Preferred Name prefix matching
For sourceName supporting people within the buckets (e.g., "from", "owner", etc.), we support prefix matching using their preferred names (or nicknames). So if facetBucketFilter is applied to the “from” facet using the prefix “Adi,” it will give all the people whose either name or preferred name has a prefix of “Adi”.