#community-help

Understanding Purpose of Facet Fields in Typesense

TLDR John sought clarification about the use of facet fields in Typesense. Jason clarified that while previously dataset needed both facet and non-facet fields, this is now redundant.

Powered by Struct AI
+12
4
28mo
Solved
Join the chat
May 20, 2021 (28 months ago)
John
Photo of md5-7a0ab48aa8979a59e1d8c3919797c1f8
John
01:11 AM
Needing Clarification about Facets: in the example https://typesense.org/docs/0.20.0/guide/building-a-search-application.html#sample-dataset I see that for each record the sample books dataset adds 2 facet fields: publication_year_facet and authors_facet, additionally to the puclication_year and authors fields. Sure, I saw that the sample schema defines these two fields as facet fields... but does that enforce these two _facet fields to be always included? What is the purpose of these _facet fields, since in the sample dataset they seem to always be a copy of the non _facet ones?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
01:16 AM
Good catch. That's actually an old dataset that we generated back when you had to define facet and non-facet fields separately and essentially duplicate the data 😨

We've since addressed this in the past year or so, so now you can just use one field and set facet: true on it
01:17
Jason
01:17 AM
Adding this to our backlog to fix the dataset
+12
John
Photo of md5-7a0ab48aa8979a59e1d8c3919797c1f8
John
01:28 AM
OK, cool! Thanks mate!🙂