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