Treat fuzzy search as starts with when operating locally
This commit is contained in:
parent
af3802e28a
commit
9ee53f7ee8
|
@ -85,6 +85,11 @@ export const luceneQuery = (docs, query) => {
|
|||
return !doc[key] || !doc[key].startsWith(value)
|
||||
})
|
||||
|
||||
// Process a fuzzy match (treat the same as starts with when running locally)
|
||||
const fuzzyMatch = match("fuzzy", (key, value, doc) => {
|
||||
return !doc[key] || !doc[key].startsWith(value)
|
||||
})
|
||||
|
||||
// Process a range match
|
||||
const rangeMatch = match("range", (key, value, doc) => {
|
||||
return !doc[key] || doc[key] < value.low || doc[key] > value.high
|
||||
|
@ -114,6 +119,7 @@ export const luceneQuery = (docs, query) => {
|
|||
const docMatch = doc => {
|
||||
return (
|
||||
stringMatch(doc) &&
|
||||
fuzzyMatch(doc) &&
|
||||
rangeMatch(doc) &&
|
||||
equalMatch(doc) &&
|
||||
notEqualMatch(doc) &&
|
||||
|
|
Loading…
Reference in New Issue