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

Parent of nested object array is the array of object itself and not the parent object #1746

Open
ddavid67 opened this issue May 21, 2024 · 1 comment

Comments

@ddavid67
Copy link

Description

Parent of nested object array is the array of object itself and not the parent object

Steps to reproduce

Create collection

{
	"name": "vids",
	"fields": [
		{
			"name": "tags.id",
			"type": "string[]",
			"facet": true
		}
	],
	"enable_nested_fields": true
}

Import a document

  {
    "tags": [
      {
        "id": "tag-1",
        "name": "name of tag 1"
      },
      {
        "id": "tag-2",
        "name": "name of tag 2"
      }
    ]
  }

Search with facet

q: *
facet_by: tags.id
facet_return_parent:  tags.id 

http://127.0.0.1:8108/collections/vids/documents/search?q=*&facet_by=tags.id&facet_return_parent=tags.id

Result

    "facet_counts": [
        {
            "counts": [
                {
                    "count": 1,
                    "highlighted": "tag-2",
                    "parent": [
                        {
                            "id": "tag-1",
                            "name": "name of tag 1"
                        },
                        {
                            "id": "tag-2",
                            "name": "name of tag 2"
                        }
                    ],
                    "value": "tag-2"
                },
                {
                    "count": 1,
                    "highlighted": "tag-1",
                    "parent": [
                        {
                            "id": "tag-1",
                            "name": "name of tag 1"
                        },
                        {
                            "id": "tag-2",
                            "name": "name of tag 2"
                        }
                    ],
                    "value": "tag-1"
                }
            ],
            "field_name": "tags.id",
            "sampled": false,
            "stats": {
                "total_values": 2
            }
        }
    ],

Expected Behavior

Parent of tag-1 shoud be :

 {
    "id": "tag-1",
    "name": "name of tag 1"
 }

Parent of tag-2 shoud be :

 {
    "id": "tag-2",
    "name": "name of tag 2"
 }

Actual Behavior

Looks like the parent is the complete tags field, and not the tag object itself.

Metadata

Typesense Version: 26.0

OS: ubuntu

@kishorenc
Copy link
Member

This is fixed in 27.0.rc14.

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

No branches or pull requests

2 participants