I have attributes stored as an array of nested obj...
# community-help
b
I have attributes stored as an array of nested objects where each attribute has type/name/string_value/int_value fields. Can i facet a search on a given attribute name and return the entire parent? We tried with facet_return_parent but maybe we used it wrong
j
facet_return_parent
is the way to achieve this...
Could you share a set of curl requests like this with the format of the docs you have, and the search parameters you're using, what you're seeing as the response, and what you expect the response to be?
b
Will do on monday :)
👍 1
ok, so i have tested now and I get it to work sort of. my schemas has these fields. and when using facet_by: attributes.string_value and facet_return_parent: “attributes.string_value” it is not possible for me to only get the facets for the traits that have a specific trait_type.
Copy code
{
      "name": "attributes",
      "type": "object[]",
      "optional": true
    },
    {
      "name": "attributes.trait_type",
      "type": "string[]",
      "facet": true
    },
    {
      "name": "attributes.string_value",
      "type": "string[]",
      "facet": true,
      "optional": true
    }
{“id”: “1",“nme”: “Test1", “attributes”: [ { “trait_type”: “Tier”, “string_value”: “Common” }, { “trait_type”: “Full Name”, “string_value”: “Bob” }} {“id”: “2”,“nme”: “Test2”, “attributes”: [ { “trait_type”: “Tier”, “string_value”: “Common” }, { “trait_type”: “Full Name”, “string_value”: “Terry” }} {“id”: “3",“nme”: “Test3", “attributes”: [ { “trait_type”: “Tier”, “string_value”: “Uncommon” }, { “trait_type”: “Full Name”, “string_value”: “John” }}'
so given that test data I want to only get facets for Tier
something like this
is it possible for facet_query to operate on data in parent?
We had an internal discussion about this and I think we just have to manually group the facet result on the attributes.trait_type when making the UI.
âž• 1