Fix issue with falsey lucene values being ignored
This commit is contained in:
parent
c1613eda5c
commit
77c96b37b3
|
@ -72,7 +72,7 @@ const cleanupQuery = query => {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for (let [key, value] of Object.entries(query[filterField])) {
|
for (let [key, value] of Object.entries(query[filterField])) {
|
||||||
if (!value || value === "") {
|
if (value == null || value === "") {
|
||||||
delete query[filterField][key]
|
delete query[filterField][key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ export const runLuceneQuery = (docs, query) => {
|
||||||
return docs
|
return docs
|
||||||
}
|
}
|
||||||
|
|
||||||
// make query consistent first
|
// Make query consistent first
|
||||||
query = cleanupQuery(query)
|
query = cleanupQuery(query)
|
||||||
|
|
||||||
// Iterates over a set of filters and evaluates a fail function against a doc
|
// 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
|
// Process a range match
|
||||||
const rangeMatch = match("range", (docValue, testValue) => {
|
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)
|
// Process an equal match (fails if the value is different)
|
||||||
|
|
Loading…
Reference in New Issue