Nested Metadata Filtering
Introduction
In Layar version 1.16, you can utilized nested metadata filtering in order to further refine chunk retrieval. This guide will go over how to utilize this feature.
Making the searchFilters
Think of nested filters like a logic tree, the first searchOperator
determines the searchConditons
below it. When supplying a nested searchOperator
you must provide a new searchFilters
as well. Lets look at an example of this.
{
"query": "Who works at Certara and is in the AI department AND worked here for more than 5 years or are based in PA?",
"searchOperator": "AND",
"searchFilters": [
{
"documentType": "DOCUMENT",
"searchConditions": [
{
"field": "company",
"operator": "in",
"value": "certara"
}
]
},
{
"documentType": "DOCUMENT",
"searchConditions": [
{
"field": "department",
"operator": "==",
"value": "certara_ai"
}
]
},
{
"documentType": "DOCUMENT",
"searchOperator": "OR",
"searchFilters": [
{
"documentType": "DOCUMENT",
"searchConditions": [
{
"field": "location",
"operator": "==",
"value": "PA"
},
{
"field": "start_year",
"operator": "<",
"value": 2020
}
]
}
]
}
]
Above we can see that there are two separate conditions, the top condition is if the company is certara
AND the department is certara_ai
. The OR operator exists under the AND operator, supplying a separate searchFilters
with a list of searchCondtions
. These conditions will not be applied unless the top layer is satisfied.
Updated 8 days ago