I'm wondering what's the best way to store a docum...
# community-help
r
I'm wondering what's the best way to store a document that has a field category, which I would like it to also be a facet, but the document belongs to multiple categories
j
You'd essentially need to pre-join the categories into each document. So every document would have a
string[]
called
categories
and you'd add all categories that the record belongs to in that array field
r
Copy code
document = {
  'id': '124',
  'title': 'Stark Industries to green energies',
  'category': ['growth', 'tech']
}
would a facet filter just on 'tech' return this document?
j
Yup it will
You'd have to declare
category
as
facet: true
in the collection schema
r
perfect! awesome!
👍 1
btw I saw your post on github asking meilisearch guys to change their comparison to typesense. You should consider making your reply into some sort of document in the documentation or on the website
I found it very useful
thanks for the help
j
Oh ha! It eventually materialized into this table: https://typesense.org/typesense-vs-algolia-vs-elasticsearch-vs-meilisearch/
r
ah that makes sense 🙂
j
May I know which specific pieces in my response you found useful? I was mainly critiquing their note about Typesense (which they've now removed)...
r
so I liked the default_sorting_field I wasn't even looking at it, and not something that I will use now, but it makes a lot of sense. "we've heard about teams successfully switching from Algolia to Typesense in production" "we've deployed 100s of production-grade clusters on Typesense Cloud" then the showcases although I had looked at those, but didn't notice the size of the datasets before.
would be really cool to see a case study (maybe there's one already?) on teams moving from algolia to typesense
j
Interesting! Good to know. Admittedly we're a little lacking on the marketing front. One user recently voluntarily offered to do a case study for us. May be I'll take them up on it... Time being the main constraint!
🙌 1