# Aspect
# Description
An aspect is a way in which your collection of items can be categorised. For example, for a collection of books, possible aspects may include the genre of the book or the colour of the cover.
A child aspect defines an aspect of an aspect. For example, if an aspect for a collection of books is "Genre", a child aspect of "Genre" could be "Series". <Child> tags must be specified within an aspect tag. If you do so you must also define the child as an aspect itself within <Aspects>.
Creating aspects allows for your search requests to be able to access data or facets categorised under that aspect name and can use them to gather data. Creating an aspect creates an Index (opens new window) that can then be used to search the data e.g. Genre.
# Syntax
<Aspects FacetComparer="string">
<Aspect Name="string" Key="string" MultiSelectMode="string">
<Child>ChildTag</Child>
</Aspect>
<Aspect Name="ChildTag" Key="string" MultiSelectMode="string" ChildOnly="true" />
</Aspects>
# Attributes
Note: all attributes marked with * are required.
- FacetComparer (string):
- Lets you input a specific string comparer, for more info on available comparers, see StringComparer.
- Name* (string):
- Name is the identifier of your index. This identifier uniquely refers to a specific "aspect" that you would use to query the search engine, as well as for any responses from the search engine that would refer to the same aspect.
- Key* (string):
- Specifies a JSON Path to be used with that aspect name.
- Func* (string) Replaces Key:
- ContextKey (string):
- ContextKey defines the name of a JSON array that your aspect will be contained within when returning search results. This functionality allows you to group several aspects within the same array for formatting purposes.
- Example: When searching for books of a specific genre, the child aspect series will appear, if that child aspect is not given a context key it will not be grouped into an array and will end up looking messy in the output. Consider giving it a context key such as BookSeries or Series.
- MultiSelectMode (
And,OrorNone) (default :None):- This Section is iNav ONLY and determines how iNav generates the facet action for an aspect
Or: The result in the action section will be (Or.Colour.Green._.Colour.Red.) if Colour.Green is already selected.And: The result in the action section will be (And.Colour.Green._.Colour.Red.) if Colour.Green is already selected.
- This Section is iNav ONLY and determines how iNav generates the facet action for an aspect
- ChildOnly (string):
- This refers to whether the aspect is a child of another or not, the boolean is case sensitive and will not accept upper case T or F in True and False.
# Example One
Let's say you wanted to categorise a collection of items by their colour. You want the user to be able to select multiple colours when navigating through your items. However, if the user were to select colours "Red" and "Green", you want to display clothing items that are either "Red" or "Green", rather than both "Red" and "Green".
# Code
The above scenario would be configured using the following XML.
<Aspect Name = "Colour" Key = "Specification.Colour" MultiSelectMode = "Or" />
