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)
|
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
|
// Process a range match
|
||||||
const rangeMatch = match("range", (key, value, doc) => {
|
const rangeMatch = match("range", (key, value, doc) => {
|
||||||
return !doc[key] || doc[key] < value.low || doc[key] > value.high
|
return !doc[key] || doc[key] < value.low || doc[key] > value.high
|
||||||
|
@ -114,6 +119,7 @@ export const luceneQuery = (docs, query) => {
|
||||||
const docMatch = doc => {
|
const docMatch = doc => {
|
||||||
return (
|
return (
|
||||||
stringMatch(doc) &&
|
stringMatch(doc) &&
|
||||||
|
fuzzyMatch(doc) &&
|
||||||
rangeMatch(doc) &&
|
rangeMatch(doc) &&
|
||||||
equalMatch(doc) &&
|
equalMatch(doc) &&
|
||||||
notEqualMatch(doc) &&
|
notEqualMatch(doc) &&
|
||||||
|
|
Loading…
Reference in New Issue