#community-help

Facet Exclusion in Typesense Query

TLDR Kyle asked if there was a way to exclude results from a specific facet in Typesense query. Kishore Nallan asked for sample docs and exact query to better understand the question.

Powered by Struct AI
Feb 09, 2023 (7 months ago)
Kyle
Photo of md5-d62c888559aeefb5fc083766631ff05e
Kyle
09:34 PM
Is there a way to exclude results from a particular facet? If I have documents with a Camera, Lens, and Film which are each faceted and I search for Nikon I would expect to get back results from Camera & Lens but not Film because Nikon isn't a film manufacturer. However my current query still returns results for the Film facet like Kodak Gold because some documents have a Nikon camera and lens but on Kodak film. Is there any way to enforce this exclusion so that the Film facet would show 0 results because there is no text search result in that specific facet that matches our query of Nikon?

To elaborate just a bit further the query Kodak Gold should also just return Film hits and not any results for Camera or Lens because they aren't text matches. I can break up the search for just those specific facets but I would like to not have to do multiple hits to the typesense db
Feb 10, 2023 (7 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:38 AM
👋 Can you please provide 2 sample documents: one which you want to return, and the other you don't? Also, the exact query you are making? This will help me understand your question better.