Search and Chat Filters
Dynamically filter the search and chat results.
Scenario
In this guide, we'll explore how to filter the search and chat results using custom tags and attributes. This allows you to tailor the search experience based on specific criteria, such as product versions or SDKs. By using filters, you can ensure that users only see relevant results based on their current context or preferences.
Filters
Filters can be defined using the filters
property of the InkeepBaseSettings
interface. These filters will apply to both the search and chat experiences. Alternatively you can also define filters in the InkeepSearchSettings
and InkeepChatSettings
interfaces to apply them only to the search or chat experience respectively.
Supported Operators
Comparison Operators: $eq
, $ne
, $gt
, $gte
, $lt
, $lte
Array Operators: $in
, $nin
Boolean Operators: $exists
Logical Operators: $and
, $or
Filter by custom tags and attributes
A common filter scenario is you have docs that covers many products, versions, and SDKs.
The first part to setting up filters is to add <meta>
tags prefixed with inkeep:
to each page. For example:
Then to filter the search and chat with your custom tags version
and sdk
:
Filters can be dynamically generated based on the page the user is on, giving full control over the search and chat experience.
Filter by source id
You can also filter by source id. This is useful if you want to show only specific sources in the search and chat results. You can find the source id in the Inkeep Dashboard by going to the Sources tab, then selecting the particular source you would like to get the id for.
To filter by multiple source ids, you can use the $or
operator like so: