Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting a filterableAttributes must make the nested field facetSearchable too #4638

Open
Kerollmops opened this issue May 16, 2024 · 3 comments
Labels
bug Something isn't working as expected needs more info This issue needs a minimal complete and verifiable example

Comments

@Kerollmops
Copy link
Member

Kerollmops commented May 16, 2024

When setting a field in the filterable attributes tags, it seems that the nested fields tags.level0 are not facet searchable, and trying to search on it throws an error. This has been reported in this discussion.

@Kerollmops Kerollmops added the bug Something isn't working as expected label May 16, 2024
@curquiza curquiza added the needs more info This issue needs a minimal complete and verifiable example label May 20, 2024
@curquiza
Copy link
Member

@Kerollmops did not try to reproduce the bug, we need to reproduce it to ensure this is a bug

@curquiza
Copy link
Member

curquiza commented May 22, 2024

Hey, I quickly tested with v1.8.1, and I did not manage to reproduce

document:

[
  { "id": 2,    "identity": { "name": "Clem", "age": 25 } }
]

Settings

{
    "searchableAttributes": ["identity"],
    "filterableAttributes": ["identity"]
}

I tried both searches and I got not issues

{
    "q": "",
    "facets": ["identity"]
}

{
    "hits": [
        {
            "identity": {
                "name": "Clem",
                "age": 25
            },
            "id": 2
        }
    ],
    "query": "",
    "processingTimeMs": 0,
    "limit": 20,
    "offset": 0,
    "estimatedTotalHits": 1,
    "facetDistribution": {
        "identity": {},
        "identity.age": {
            "25": 1
        },
        "identity.name": {
            "Clem": 1
        }
    },
    "facetStats": {
        "identity.age": {
            "min": 25.0,
            "max": 25.0
        }
    }
}
{
    "q": "",
    "filter": "identity.age = 25"
}

{
    "hits": [
        {
            "identity": {
                "name": "Clem",
                "age": 25
            },
            "id": 2
        }
    ],
    "query": "",
    "processingTimeMs": 0,
    "limit": 20,
    "offset": 0,
    "estimatedTotalHits": 1
}

@bradenmacdonald
Copy link

bradenmacdonald commented May 24, 2024

@curquiza You didn't try the "facet search API", which is the one with the bug. If I recall correctly, the request to .../facet-search should look like

{"facetName": "identity.name", "facetQuery": "Clem", "q": "", "filter": []}

(separate issue about the opposite - searching for the parent field but wanting matches on child fields:)

In addition, there is a problem with the shape of the facet search API response - if you could facet keyword search for identity and have it return results from identity.name and identity.age as I would like, the current API response does not even have a field to indicate which facets actually matched.

{
    "facetHits": [
        {
            "value": "Which facet did this value come from? Who knows...",
            "count": 25
        },
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected needs more info This issue needs a minimal complete and verifiable example
Projects
None yet
Development

No branches or pull requests

3 participants