Implementer training - search result filters (faceted navigation)
Faceted navigation can be used to filter or refine a set of search results, allowing users to quickly drill down on items or sub-sections of interest within a search that may contain hundreds of thousands of results.
Faceted navigation is designed to help users refine their search by providing a set of filters that are applicable to the set of search results returned by the search query.
Facets contain categories and the default display shows a count of matching results for each category. Categories without any matching results are hidden, preventing users from running a search that returns no results.
Facets and category values
A facet represents a way in which your documents can be categorized (e.g. job, location or author).
Category values are the individual values that can be filtered on.
e.g. For a facet holding various authors: the author is the facet while Ada, Alan and Bob are the category values that the user might select to restrict the documents to.
Types of facets
Funnelback supports five types of facets. Each type allows a user to filter the result set.
The types differ by proving choice in how the filtering is applied - allowing filtering on single or multiple categories and providing options on how the filters are combined and how they apply to the result set.
Filter on a single category
Allows a user to filter the result set using a single category value chosen from the facet. Upon selection the facet displays only the selected category value.
Filter on a single category, with drill down
This is sometimes referred to as a hierarchical facet.
Allows a user to filter the result set using a single category value chosen from the facet. After the filter is applied sub-categories may be displayed for the facet.
Filter on multiple categories
This is sometimes referred to as multi-select or checkbox faceting.
Allows a user to filter the result set using multiple categories from the same facet. The categories can be combined using either AND or OR logic.
Toggle between categories
Sometimes also referred to as a radio facet.
Allows a user to filter the result set on a single category. The set of categories remain after the filter is applied allowing a user to toggle through the different categories.
Toggle between tabs
This is a special type of facet that is presented as a series of tabs. It is designed to allow a search to be separated into a series of tabs, with other facets then being used to further filter the result set. Because of this the tab facet isn’t
Tutorial: Add a facet
In this exercise a filter on single category facet, with categories sourced from an existing metadata field will be configured for the silent films search results page. Use of metadata as a category source requires metadata to be configured for the data source prior to faceted navigation being configured.
Before you configure faceted navigation you need to work out what you will use for the faceted navigation - in this case we’ll use the metadata fields that we configured via external metadata (director, language, year, etc.).
-
Log in to the search dashboard where you are doing your training.
See: Training - search dashboard access information if you’re not sure how to access the training. Ignore this step if you’re treating this as a non-interactive tutorial. -
Locate the silent films search package.
-
Load the results page management screen for the silent films search results page.
-
Open the faceted navigation editor by selecting customize faceted navigation from the customize panel.
-
Create a new facet by clicking on the add new button. A facet is a filter that will be returned with the search results.
-
The new facet screen allows you to choose from 6 different types of facets. Hovering over the images provides some immediate feedback on how the facet behaves. Click on the filter on a single category tile.
-
Enter
Director
as the name for the facet. -
The category source then needs to be selected by choosing an item from the drop-down that appears beneath the category values heading. Select predefined values contained in a metadata or XML field (metadata) from the list and select
director
(the metadata class name that you defined in the data source metadata mappings) as the value for the metadata field. If there are many fields defined you may need to start typing the name of the class you are looking for then select it from the items returned. Note that metadata field names are case-sensitive and must exactly match the class name that is defined in the mappings. Click the add button. -
The facet listing screen updates to display the director facet. Observe that the facet is currently unpublished and there is a button available to publish the facet definition.
-
Add a second facet called
Release year
that sources the metadata values from theyear
metadata class. This time click the add and publish button. -
Run a search for !showall against the live version of the silent films search results page and observe that there is one facet (Release year) and the values returned for each facet are the individual values that are defined for the metadata fields. Observe that the Director facet is not displaying. This is because the facet has not been published. If you repeat the query on the preview version of the search you will see both facets.
-
Return to the faceted navigation editor and click the publish button for the director facet. Repeat the live search above and observe that both facets now display.
-
Click unpublish on the release year facet and rerun the live search observing that the director facet is now the only facet returned.
-
Faceted navigation counts the different values it finds - so for a facet to be effective you need to make sure your metadata field is populated with consistent values - where the same values are used on many items (such as a controlled list of keywords).
-
Observe that the facet categories presented are all lower case - this is because Funnelback treats the keywords as case-insensitive when counting the facets (i.e. Hitchcock = hitchcock). The capitalization can be preserved to match the metadata field values, but be aware that you may start to see duplicate terms if the capitalization of the keywords doesn’t match for all pages. A display option (
-rmc_sensitive
) must be set to make the facet categories case-sensitive. In the results page configuration add an additional display option to the query processor options. Add-rmc_sensitive=true
to the list values and then click the save button. -
Reload the search results page and observe that all the categories are now case-sensitive.
Facet categories
Facet category values are the individual filter choices that appear beneath a facet.
Each facet contains one or more facet categories. Selecting a facet category will filter the search results on include only results that include the category (subject to any other selected categories and the matching logic).
Category sources
Facet categories are sourced from a number of different things. Understanding how the facets and facet categories relate to the source data is important for creating effective faceted navigation (and for planning site redevelopments to make use of facets).
Categories based on metadata
A facet that has category values sourced from predefined values contained within a metadata or XML field (metadata) has a 1:1 relationship between the facet and a Funnelback metadata class.
The categories that can appear beneath a metadata facet are all the unique values found within the metadata class. The count for each category is the number of unique times that the metadata value is found within the result set.
Categories based on URL patterns or gscopes
A facet that has category values sourced from predefined URL sets (generalized scopes or gscopes) or a set of URL patterns (URL pattern) has a 1:1 relationship between each category and a defined URL pattern set or generalized scope.
The category label is determined by the label assigned when creating the facet.
The count for each category is the number of items in the result set that belong to the defined URL pattern set or gscope.
Generalized scopes are used to define sets of URLs and are covered in the SEARCH 202 training course. |
Categories based on URL path or directory structure
A facet that has category values sourced from the item’s location in a URL path or directory structure (URL fill) has a 1:1 relationship between the facet and a defined root URL or folder.
The categories are determined by splitting the URL on the folder structure (with folder names as the possible categories) to a determined depth. The depth defines a hierarchical structure to apply to the facet.
The count for each category is the number of results that sit beneath the folder.
Categories based on date
A facet that has category values sourced from groupings based on the item’s date (dynamic date fill) has a 1:1 relationship between the facet and the document’s indexed date value.
The categories that are determined from hardcoded groupings of dates and the counts are based on the number results with a date value such as yesterday, last week, last month, 2014.
Categories based on results from a query
A facet that has category values sourced from documents which match a particular query has a 1:1 relationship between each category and the set of URLs returned for the defined query.
The category label is determined by the label assigned when creating the facet.
The count for each category is the number of items in the result set that are in the set of results returned for the defined query.
Categories based on data source
A facet that has category values sourced from documents which belong to a particular data source has a 1:1 relationship between each category and membership to sets of data sources.
The category label is determined by the label assigned when creating the facet.
The count for each category is the number of items in the result set that belong to each defined set of data sources.
Categories based on numerical range
A facet that has category values sourced from documents whose metadata value lies within a numerical range has a 1:1 relationship between each category and the number of results returned that belong to each defined range.
The category label is determined by the label assigned when creating the facet.
The count for each category is the number of items in the result set that are in each of the pre-defined ranges.
Category counts
The counts displayed for categories are estimates that are calculated based on the result set. Because of this the accuracy will reduce as the search index becomes larger. The numbers may also change when a facet is selected as the estimates are recalculated every time the result set is produced.
Sorting category values
Facet category values can be sorted by a number of different attributes:
-
count: the category values are sorted by the category count, either largest to smallest, or smallest to largest.
-
label: the category values are sorted by the label, either alphabetically (A-Z) or reverse alphabetically (Z-A).
-
numeric label: the category values are sorted by the label, but with numbers interpreted numerically. e.g. a numeric label sort would sort as follows: 1, 10, 11, 100, compared with a label sort which would sort: 1, 10, 100, 11.
-
date: the category values are sorted by date, either most recent to oldest, or oldest to most recent.
-
selected values first: selected category values are placed above unselected category values.
-
configuration order: for facet types where the individual category values are defined, the order in which they appear in the configuration will be the order that is used to display the facets. The order can be changed by dragging the items around in the configuration.
-
custom sort logic: custom sort logic, implemented via a plugin, is used to sort the category values. Can be used to apply custom sort ordering to metadata based facets.
Blacklisting and whitelisting category values
Two search package configuration options can be used to restrict the category values that can be displayed within a facet.
-
faceted_navigation.black_list
: category values listed will be removed from the facet if they are returned in the list of facets. -
faceted_navigation.white_list
: only the category values listed will be displayed if they are returned in the list of facets. Other category values are removed.
Tutorial: Query based faceted navigation
In this exercise query based facets will be configured for the silent films search results page from previous exercises.
-
Log in to the search dashboard where you are doing your training.
See: Training - search dashboard access information if you’re not sure how to access the training. Ignore this step if you’re treating this as a non-interactive tutorial. -
Locate the silent films search package.
-
Load the management screen for the silent films search results page.
-
Open the faceted navigation editor by selecting customize faceted navigation from the customize panel.
-
Create a new filter on single category facet by clicking on the add facet button then selecting the filter on single category tile. The two metadata facets from the previous example will be displayed in the editor.
-
Enter
Director (query)
as the name for the facet and select documents which match a particular query from the category values are sourced from dropdown. Enter"charlie chaplin"
(including the double quotes) into the query field andCharlie Chaplin
into the label field. The double quotes ensure that the query is run as a phrase. The value inside the label field is what the user will see as a choice to click on.A re-index is required after adding or changing any query based faceted navigation categories. -
Add a second category by clicking the
+
button next to the Director (query) facet. Enter a second item for Buster Keaton using"buster keaton"
as the query andBuster Keaton
as the label. -
Then select add and publish from the dropdown on the add button.
-
Switch to the silent films - website data source and run an advanced update. Rebuild the index by running the re-apply gscopes to the live view option. This is required to generate the generalized scopes that underpin the categories for the query-based facets. Running a re-index of the live view will also regenerate the facets but may take longer as a number of other operations are run as part of the re-index.
Gscopes (or generalized scopes) allow an administrator to define sets of pages based on the URL matching a pattern or query that can be used for query scoping, defining the set of pages in a results page and fot faceted navigation. Gscopes are covered in detail in the SEARCH 202 training course. -
Run a search for !showall against the silent films search results page and observe that there is an additional facet Director (query) and the values returned for each facet are the two categories that you just defined. Faceted navigation for query categories (and predefined URL set/gscope based categories) requires a separate entry for each category that will counted. The counts refer to the number of items in the result set that match the query defined in the facet configuration. This differs from metadata facets that count all the unique metadata values that appear within a metadata field. For this reason query and gscope facets are more difficult for an administrator to maintain as the faceted navigation configuration must be updated every time a new category is added. For metadata based facets new categories that are added to an existing metadata field will automatically appear.
Extended exercises: Faceted navigation
-
Create a dates field fill facet that builds a facet based on the document dates.
-
Recreate the director facet as a filter on multiple categories facet.
-
Update the template code to apply an ordering to the facets. (hint: instructions are provided in the documentation link below)
-
Change the sort order for the release year to be alphabetic