Update client side lucene implemenation to mirror real lucene by not matching when the value is nullish

This commit is contained in:
Andrew Kingston 2021-08-26 18:00:36 +01:00
parent 23a6267f6a
commit a466c31430
1 changed files with 2 additions and 2 deletions

View File

@ -103,12 +103,12 @@ export const luceneQuery = (docs, query) => {
// Process an equal match (fails if the value is different) // Process an equal match (fails if the value is different)
const equalMatch = match("equal", (key, value, doc) => { const equalMatch = match("equal", (key, value, doc) => {
return doc[key] !== value return value != null && value !== "" && doc[key] !== value
}) })
// Process a not-equal match (fails if the value is the same) // Process a not-equal match (fails if the value is the same)
const notEqualMatch = match("notEqual", (key, value, doc) => { const notEqualMatch = match("notEqual", (key, value, doc) => {
return doc[key] === value return value != null && value !== "" && doc[key] === value
}) })
// Process an empty match (fails if the value is not empty) // Process an empty match (fails if the value is not empty)