Fix issue with falsey lucene values being ignored
This commit is contained in:
parent
7eaed5bea7
commit
5c5e4bcccb
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue