nextapps-de / flexsearch

Next-Generation full text search library for Browser and Node.js
Apache License 2.0
12.53k stars 491 forks source link

Is it possible to negate/disallow a term? #252

Closed RShohoney closed 2 years ago

RShohoney commented 3 years ago

This is not a bug, but just a question. If the answer is no, then I think this is a feature request. Let me know if this is not the right place for this question.

I've looked through the docs a few times, but I can't seem to find a definitive answer. Is it possible to negate/disallow a term? Say I want to find all of the records that don't contain a term. In similar full text search systems, we can use + to require a term be present and - to require a term must not exist. Is something like this possible? If not, is there a relatively similar work around? If not, how difficult would this be to implement?

RShohoney commented 3 years ago

It appears that this was discussed in https://github.com/nextapps-de/flexsearch/issues/42 but it appears that the "not" operator was either dropped, or is not documented.

It was also lightly discussed here, but "NOT" still doesn't get addressed directly. https://github.com/nextapps-de/flexsearch/issues/138

ts-thomas commented 2 years ago

Such a filter needs to be applied manually when getting back the enriched result.