DomDew / strapi-plugin-fuzzy-search

Register a weighted fuzzy search endpoint for Strapi Headless CMS you can add your content types to in no time
https://www.npmjs.com/package/strapi-plugin-fuzzy-search
MIT License
73 stars 19 forks source link

Is it possible to deep filter results #212

Open lburns-civiconnect opened 2 months ago

lburns-civiconnect commented 2 months ago

As an example from my restaurant app, I have two collections: Menu Items and Allergens. Allergens is a many-1 relationship with Menu Items. I want to be able to fuzzy search Menu Items on the "name" field, while filtering for allergens. E.x. Give me "burgers" that don't contain "gluten".

The structure of my object would be:

{
  id: 1
  name: "hamburger"
  contains: [
    {
      id: 2,
      AllergenLabel: "Gluten",
     ...
    },
    ...
  ],
  ...
}

The regular Strapi API supports this by doing filters[contains][AllergenLabel][$ne]=Gluten When I try the fuzzy search scoped filtering like filters[menu-items][contains][AllergenLabel][$ne]=Gluten it doesnt work.

lburns-civiconnect commented 2 months ago

This also looks to be an open issue in Strapi where deep filtering specifically on a negative ($ne, $notIn, etc.) doesn't work.