mirror of
https://github.com/thangisme/notes.git
synced 2024-12-22 13:56:28 -05:00
Fixed fuzzy search hangs for long words
This commit is contained in:
parent
da9276121a
commit
b7a5458375
@ -157,12 +157,16 @@ function searchLoaded(index, docs) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if ((results.length == 0) && (input.length > 2)) {
|
if ((results.length == 0) && (input.length > 2)) {
|
||||||
results = index.query(function (query) {
|
var tokens = lunr.tokenizer(input).filter(function(token, i) {
|
||||||
var tokens = lunr.tokenizer(input)
|
return token.str.length < 20;
|
||||||
query.term(tokens, {
|
})
|
||||||
editDistance: Math.round(Math.sqrt(input.length / 2 - 1))
|
if (tokens.length > 0) {
|
||||||
|
results = index.query(function (query) {
|
||||||
|
query.term(tokens, {
|
||||||
|
editDistance: Math.round(Math.sqrt(input.length / 2 - 1))
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (results.length == 0) {
|
if (results.length == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user