I don't get the facet_return_query to work. What a...
# community-help
c
I don't get the facet_return_query to work. What are the requirements, object itself be indexed/facet? Do the fields that I want to return have to be indexed/facet? Or just the field that I actually facet by? I tired to search the repo on github without any luck so I started to wonder if it was removed? I'm using 27.1. In github I only found a cost and some tests but no impl reference to the argument name or the const variable (but I also had my kids running around so focus was not 100%).
The problem I have with it is that I don't get any parent field, no matter what I do.
The facet value I'm using was city.name and I wanted to include city.slug. The collections is pizzerias. So city is a field on the pizzeria document.
k
The parameter is called
facet_return_parent
Please also try with the latest v28 rc build. I remember us fixing an issue we found on v27.1
c
Sorry. Im on the phone, wrote the wrong thing. I copied the parameter from docs. OK, will do 👍
tried it now using rc33, same result, My query is a multi search looking like this: { searches: [ { q: "*", collection: "pizzerias", facet_by: "city.name", facet_return_parent: "city.slug", per_page: 1, max_facet_values: 9999, facet_strategy: "exhaustive", }, ], } And i also include a screenshot of a document in dashboard, the whole doc is way too big to add.
Is there something obviously wrong with the way I query? And what are the requirements when it comes to indexing to get the parent field to be included in the facet response?
k
Did you try:
Copy code
"facet_return_parent": "city.name",
❤️ 1
💫 1
1
If that does not work, please produce a set of curl commands that can reproduce the issue, like this: https://gist.github.com/jasonbosco/7c3432713216c378472f13e72246f46b
c
hum,.. city.name does work. But i want city.slug? The facet is on name, but i need the slug in the ui..
i misunderstood everything. It gets the whole parent doc if it matches the value. When i put the same i get the full { id: 19, name: 'Jönköping', slug: 'jonkoping' }
this is awesome.
you are awesome
message has been deleted
k
Glad to hear, thank you.