Skip to content

Unable to use facetBy #28

Open
Open
@giilby

Description

@giilby

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions