#community-help

Understanding Typesense Facets Implementation

TLDR Laura was looking for clarification on Typesense's facets functionality. Jason confirmed it's similar to Algolia's filter by concept.

Powered by Struct AI
3
4mo
Solved
Join the chat
Jun 09, 2023 (4 months ago)
Laura
Photo of md5-e31442d4d6c849124582a10193fe7721
Laura
02:00 PM
I'm trying to implement this query before algolia in typesense, I read the documentation and I'm trying to understand the facets part, would they be like typesense's filter_by? That I couldn't fully understand.

const algoliaResult = await index.search(q, {
        attributesToRetrieve: ['id'],
        tagFilters,
        hitsPerPage: 24,
        facets: '*',
        facetFilters: [`product_type_code:${category}
        page,
})

Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
02:07 PM
That’s correct, we just call all filters as filter_by
Laura
Photo of md5-e31442d4d6c849124582a10193fe7721
Laura
02:45 PM
thank you!