Hey :slightly_smiling_face: I have a facet defined...
# community-help
c
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
k
👋 Yes you can facet on arrays. Can you please post a minimally reproduceable example?
c
Hmm okay, I will continue looking into it then. Thanks for the speedy response
j
@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
c
Yeh it returns no data:
k
If you can post the schema and the actual query, I can quickly 👀 if there is anything obvious missing.
c
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
k
👍 Happy to investigate if you can re-create the issue consistently.
c
Index is created by:
<REMOVED>
Query I just tested with:
<https://the-instance.com/collections/products/documents/search?q=red&query_by=product_name&facet_by=collections>
I'll see though if spinning up a new instance and a full reindex seems to fix it first too 🙂
k
Yeah that looks fine to me.
❤️ 1
c
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