Поправки багов поиска
This commit is contained in:
@@ -1160,7 +1160,7 @@ class Search {
|
||||
} else if (searchValue[0] == '#') {
|
||||
|
||||
searchValue = searchValue.substring(1);
|
||||
return !bookValue || (!enru.has(bookValue[0]) && bookValue.indexOf(searchValue) >= 0);
|
||||
return !bookValue || (bookValue !== emptyFieldValue && !enru.has(bookValue[0]) && bookValue.indexOf(searchValue) >= 0);
|
||||
} else if (searchValue[0] == '?') {
|
||||
return bookValue == '' || bookValue.indexOf(searchValue) == 0;
|
||||
} else {
|
||||
|
||||
@@ -4,6 +4,7 @@ const utils = require('./utils');
|
||||
|
||||
const maxMemCacheSize = 100;
|
||||
|
||||
const emptyFieldValue = '?';
|
||||
const maxUtf8Char = String.fromCodePoint(0xFFFFF);
|
||||
const ruAlphabet = 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя';
|
||||
const enAlphabet = 'abcdefghijklmnopqrstuvwxyz';
|
||||
@@ -45,7 +46,7 @@ class DbSearcher {
|
||||
a = a.substring(1);
|
||||
where = `@indexIter('value', (v) => {
|
||||
const enru = new Set(${db.esc(enruArr)});
|
||||
return !v || (!enru.has(v[0]) && v.indexOf(${db.esc(a)}) >= 0);
|
||||
return !v || (v !== ${db.esc(emptyFieldValue)} && !enru.has(v[0]) && v.indexOf(${db.esc(a)}) >= 0);
|
||||
})`;
|
||||
} else {
|
||||
where = `@dirtyIndexLR('value', ${db.esc(a)}, ${db.esc(a + maxUtf8Char)})`;
|
||||
|
||||
Reference in New Issue
Block a user