diff --git a/packages/frontend-core/src/utils/lucene.js b/packages/frontend-core/src/utils/lucene.js index b9f673668e..243b7ba646 100644 --- a/packages/frontend-core/src/utils/lucene.js +++ b/packages/frontend-core/src/utils/lucene.js @@ -72,7 +72,7 @@ const cleanupQuery = query => { continue } for (let [key, value] of Object.entries(query[filterField])) { - if (!value || value === "") { + if (value == null || value === "") { delete query[filterField][key] } } @@ -174,7 +174,7 @@ export const runLuceneQuery = (docs, query) => { return docs } - // make query consistent first + // Make query consistent first query = cleanupQuery(query) // Iterates over a set of filters and evaluates a fail function against a doc @@ -206,7 +206,12 @@ export const runLuceneQuery = (docs, query) => { // Process a range match const rangeMatch = match("range", (docValue, testValue) => { - return !docValue || docValue < testValue.low || docValue > testValue.high + return ( + docValue == null || + docValue === "" || + docValue < testValue.low || + docValue > testValue.high + ) }) // Process an equal match (fails if the value is different)