finwo / lucene-filter

Data filter for lucene queries
MIT License
9 stars 6 forks source link

Query with `NOT` in the beginning do not respect the `NOT` clause #45

Open laggingreflex opened 4 years ago

laggingreflex commented 4 years ago
const data = [
{ name: 'C-3PO'           , description: 'Protocol droid.'                , species: 'Droid' },
{ name: 'R2-D2'           , description: 'Astromech droid built on Naboo.', species: 'Droid' },
{ name: 'Anakin Skywalker', description: 'Fallen Jedi, the chosen one.'   , species: 'Human' },
{ name: 'Obi-Wan Kenobi'  , description: 'Jedi Master.'                   , species: 'Human' },
{ name: 'Moon Moon'       , description: 'Mentally challenged wolf.'      , species: 'Wolf'  },
];

console.log(data.filter(lucene('NOT anakin')));

Expected: All items except Anakin

Current result: Shows just Anakin. I.e. it ignores the "NOT" clause.

finwo commented 4 years ago

A separate NOT operator has never been implemented. It should be and will be as soon as I get the chance to rewrite this library