# Aspect Query Request
# Description
An aspect query request provides a list of all actionable facets for that aspect being queried. For example, if the aspect "Genre" is inputted into the request, an array of facets containing details about each available facet such as value and count should be generated. Only facets relating to that aspect will be shown however and the items under the "Action" element can be used in a search request to produce results using that new facet.
# Benefits of Aspect Query Request
Aspect queries allow you to gain data on possible next steps the user could take when using the website, it also provides a count on how many items there are in that next step which will could allow for things such as having that number be displayed on the website next to the option to allow for a more streamlined user experience The use of aspect queries also allows you to filter out unnecessary links so that you don't have dead links on your page that do nothing.
# Syntax
a=<aspect name>(displayNameKey:<Key>)|<parent expression>|<post processors>|<show all facets>|<sorting>
# Attributes
Note: all attributes marked with * are required.
- Aspect name*
- The aspect you wish to show the related actions for
- Display Name Key
- Display Name Key simply refers to a key that will determine which of the display names configured in Display Names will be shown in the response. If no Display Name Key is specified then it will use the default names of items.
- Parent expression
- The previous action used before using the current aspect name in order to drill deeper into the search results
- Post Processors Multiple Can Be Used Separated by a
,- Uses the seo config to generate a user friendly url or the Navigations User Attributes config to display the user attributes defined for the aspects, ranges, POI ect.
- Show All Facets
- Aspect query response does not return facets whose count is 0 by default. Use
ShowAllFacetsto show all facets.
- Aspect query response does not return facets whose count is 0 by default. Use
- Sorting
- Specify a string comparer for sorting, for more info on available comparers, see StringComparer.
- Add
~before string comparer for descending order.
# Example One
####2 Code
?a=Genre(ch)
Produces the result:
{
"AspectResult": {
"Nodes": [
{
"IsSelected": false,
"PlaceholderExpression": "(<!>)",
"MultiSelectMode": "Or",
"RemoveAction": "",
"Facets": [
{
"IsSelected": false,
"Value": "Adventure Fiction",
"Action": "Genre.Adventure Fiction.",
"Count": 1,
"Expression": "Genre.Adventure Fiction.",
"ParentExpression": "Genre.Adventure Fiction.",
"NodeExpression": "Genre.Adventure Fiction.",
"NodeFamilyExpression": "Genre.Adventure Fiction.",
"RefinementAction": "Genre.Adventure Fiction.",
"RefineableAspects": [
{
"Name": "Series",
"DisplayName": "Series",
"IsMultiSelect": true
}
]
}
],
"Query": "",
"ParentExpression": "",
"Name": "Genre",
"DisplayName": "类型",
"Type": "Aspect"
}
]
}
}
It produces a list labeled "Facets", in this list all possible facets for Make are shown with details about them. The value under "Action" within the facet item describes the action that can be copied and pasted into a regular search request to search for items where the Genre is "Adventure Fiction".
Each fact contains a filed RefineableAspects which is a list of direct child aspects.
Child aspects will be returned within RefineableAspects only when they have facets for further filter.
Each child aspect contains fields: Name, DisplayName and IsMultiSelect.
# Example Two
# Code
?a=Series|Genre.Adventure%20Fiction.|Seo(books)&q=Or.Genre.Adventure%20Fiction.
In this more detailed example, it uses the optional parameters of Parent Expression and Post-Processor. The parent expression can be described as the expression used as the initial search before computing the next request for the aspect name. For example here, the aspect query request will look for the facets of series for genres of type adventure fiction. Having the post processor included will also add an extra entry into the list called SeoUrl which will contain the SEO-friendly URL generated with the specified SEO config.
The parent processor also has to be a part of your q= query otherwise you
will be returned with a bad request error.
