typesense-swift
typesense-swift copied to clipboard
Unable to use `facetBy`
Description
When facetBy
is specified, results cannot be decoded. I believe this is because SearchResult.facetCounts
is defined as [Int]?
, but the actual value of that field is an array of documents that look like this:
facet_counts": [
{
"counts": [
{
"count": 4,
"highlighted": "Value A",
"value": "Value A"
},
...
{
"count": 1,
"highlighted": "Value B",
"value": "Value B"
}
],
"field_name": "some_field",
"stats": {
"total_values": 7
}
}
]
Steps to reproduce
Execute a search with one or more fields specified in facetBy
.
Expected Behavior
A usable SearchResult
object is returned.
Actual Behavior
A decoding exception is thrown.
Metadata
Typesense Version: 0.24.1
OS: iOS 17.0.3
same issue, could you find any solution?