Querying Nested Fields in Array Using Filters
TLDR Todd asked about using wildcards for array style searches in a nested field. Jason responded that using filter_by: topLevelField.nestedField:=5
should work. Todd confirmed that the solution was effective.
2
Jul 03, 2023 (5 months ago)
Todd
08:22 PMFor example, if I have this schema:
const schema: CollectionFieldSchema[] = [
{
name: 'topLevelField',
type: 'object[]',
facet: true,
},
{
facet: true,
name: 'topLevelField.nestedField',
type: 'int32',
},
];
And I have an entry with this shape:
{ topLevelField: [{ nestedField: 3 }, { nestedField: 5}]}
How can I filter that 5 is in the nestedField list?
Jason
08:25 PMTypesense doesn’t support wild-cards in filter values
> How can I filter that 5 is in the nestedField list?
filter_by: topLevelField.nestedField:=5
should work…
Jason
08:25 PMTodd
08:26 PM1
Todd
08:41 PM1
Typesense
Indexed 3005 threads (79% resolved)
Similar Threads
Working with Hierarchical Facets in Typesense
Narayan inquired about nested facets in typesense. Jason guided them to encode the hierarchy in the field value and filter accordingly.
Usage and Modification of Dynamic Routes in Typesense Documents
Ethan needed a way to perform exact queries through two fields in Typesense documents. Kishore Nallan demonstrated its possibility using the "filter_by". An issue was resolved via recommending that fields in 'query by' should be a string type.
Cold Start Problem with Dynamic Collections
Adrian reported cold start issues with dynamic collections. Jason suggested using wildcard `*` for query_by parameters, upgrading to `0.25.0.rc34`, and clarified conventions. Adrian's issues were resolved but they reported a limitation that will potentially be addressed.