#community-help

Faceting issue with Products Collections in Typesense

TLDR Carl was unable to facet on a string array. Kishore Nallan and Jason advised ensuring facet counts were being returned and offered to assist in troubleshooting. Issue resolved upon Carl realizing no data was saved in the database.

Powered by Struct AI

2

1

1

13
29mo
Solved
Join the chat
Sep 03, 2021 (29 months ago)
Carl
Photo of md5-b4b5ae6f21ade3ef3d7824c4b63090c3
Carl
06:17 AM
Hey 🙂 I have a facet defined as: {"name": "collections", "type": "string[]", "facet": true }, which is not returning any data. Is possible to actually facet on a string[]?

The use case here, is that a product could be associated with a variety of "collections", so it needs to be an array. If I can't facet on an array, how would I work around this?

1

Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:18 AM
👋 Yes you can facet on arrays. Can you please post a minimally reproduceable example?
Carl
Photo of md5-b4b5ae6f21ade3ef3d7824c4b63090c3
Carl
06:19 AM
Hmm okay, I will continue looking into it then. Thanks for the speedy response
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:51 AM
Carl When you say it does not return any data, do you mean no facet counts are returned? If so, in addition to defining a field as a facet in the schema, you’d need to also set the facet_by search parameter
Carl
Photo of md5-b4b5ae6f21ade3ef3d7824c4b63090c3
Carl
06:52 AM
Yeh it returns no data:
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:53 AM
If you can post the schema and the actual query, I can quickly 👀 if there is anything obvious missing.
Carl
Photo of md5-b4b5ae6f21ade3ef3d7824c4b63090c3
Carl
06:53 AM
It does so on both the multi_search (e.g. using instantsearch adapter) and by manually querying with facet_by.

I just created a new container, new index and sent some data but it worked fine. Going to try recreate the full index in the same environment to see if it just magicaly fixes
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:54 AM
👍 Happy to investigate if you can re-create the issue consistently.
Carl
Photo of md5-b4b5ae6f21ade3ef3d7824c4b63090c3
Carl
06:54 AM
Index is created by:
<REMOVED>
06:55
Carl
06:55 AM
Query I just tested with:
<https://the-instance.com/collections/products/documents/search?q=red&amp;query_by=product_name&amp;facet_by=collections>
06:55
Carl
06:55 AM
I'll see though if spinning up a new instance and a full reindex seems to fix it first too 🙂
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:56 AM
Yeah that looks fine to me.

1

Carl
Photo of md5-b4b5ae6f21ade3ef3d7824c4b63090c3
Carl
08:23 AM
The problem is that we don't have anything saved int he database for collections 😅 So all looks good from typesense side. Thanks for the quick help and have a great day 👍

2

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3011 threads (79% resolved)

Join Our Community

Similar Threads

Faceting Objects in Typesense

John wants to facet objects in Typesense, but faces issues. Kishore Nallan suggests creating a feature request on GitHub.

this

3

17
9mo

Typesense Facet Query Issue and Resolution

Stefan wanted to have typesense return count: 0 for filtered out facets, which was not supported. They shared a workaround using a server data call. The solution involved adding "facets: [this.filterConfig.attribute]," for the server adapter to work. Kishore Nallan acknowledged the resolution.

8
29mo
Solved

Production Typesense Issue with Unexpected Filter Behavior

Ankit flagged a problem with a specific filter on the production server of Typesense. After several exchanges regarding optimisation and version checks, Kishore Nallan provided latest builds to troubleshoot. The filtering within facets issue persists and potential edge cases are being investigated.

5

53
3mo

Updating Collections Strategy and Faceting New Field

Nithin asked about strategies for updating collections and faceting new fields. Kishore Nallan suggested creating another collection, indexing in the background and using aliases to switch live traffic over, and shared details about the upcoming release.

10
34mo

Discussions on Typesense, Collections, and Dynamic Fields

Tugay shares plans to use Typesense for their SaaS platform and asks about collection sizes and sharding. Jason clarifies Typesense's capabilities and shares a beta feature. They discuss using unique collections per customer and new improvements. Kishore Nallan and Gabe comment on threading and data protection respectively.

3

45
35mo
Solved