Skip to content

Commit ac1be21

Browse files
committed
Merge branch 'release/1.4.1'
2 parents 7fe0bce + b34d915 commit ac1be21

File tree

16 files changed

+122
-50
lines changed

16 files changed

+122
-50
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/node_modules
22
/server/.inpx-web*
3-
/server/inpx-web-filter.json
43
/dist
54
dev*.sh

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
1.4.1 / 2022-12-21
2+
------------------
3+
4+
- Добавлена возможность поиска по регулярному выражению (префикс "~")
5+
- Заплатка для исправления (#10)
6+
17
1.4.0 / 2022-12-07
28
------------------
9+
310
- Добавлена возможность расширенного поиска (раздел "</>"). Поиск не оптимизирован и может сильно нагружать сервер.
411
Отключить можно в конфиге, параметр extendedSearch
512
- Улучшение поддержки reverse-proxy, в конфиг добавлены параметры server.root и opds.root для встраивания inpx-web в уже существующий веб-сервер

client/components/Search/AuthorList/AuthorList.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,12 @@ class AuthorList extends BaseList {
197197
result = `${count}`;
198198
if (item.seriesLoaded) {
199199
const rec = item.seriesLoaded[book.series];
200-
const totalCount = (this.showDeleted ? rec.bookCount + rec.bookDelCount : rec.bookCount);
201-
result += `/${totalCount}`;
200+
// заплатка для исправления https://github.com/bookpauk/inpx-web/issues/10
201+
// по невыясненным причинам rec иногда равен undefined
202+
if (rec) {
203+
const totalCount = (this.showDeleted ? rec.bookCount + rec.bookDelCount : rec.bookCount);
204+
result += `/${totalCount}`;
205+
}
202206
}
203207
204208
return `(${result})`;

client/components/Search/BaseList.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,14 @@ export default class BaseList {
385385
} else if (searchValue[0] == '#') {
386386

387387
searchValue = searchValue.substring(1);
388-
return !bookValue || (bookValue !== emptyFieldValue && !enru.has(bookValue[0]) && bookValue.indexOf(searchValue) >= 0);
388+
if (!bookValue)
389+
return false;
390+
return bookValue !== emptyFieldValue && !enru.has(bookValue[0]) && bookValue.indexOf(searchValue) >= 0;
391+
} else if (searchValue[0] == '~') {//RegExp
392+
393+
searchValue = searchValue.substring(1);
394+
const re = new RegExp(searchValue, 'i');
395+
return re.test(bookValue);
389396
} else {
390397
//where = `@dirtyIndexLR('value', ${db.esc(a)}, ${db.esc(a + maxUtf8Char)})`;
391398
return bookValue.localeCompare(searchValue) >= 0 && bookValue.localeCompare(searchValue + maxUtf8Char) <= 0;

client/components/Search/Search.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ class Search {
593593
this.list.liberamaReady = true;
594594
this.sendMessage({type: 'mes', data: 'ready'});
595595
this.sendCurrentUrl();
596+
this.makeTitle();
596597
break;
597598
}
598599
}
@@ -789,6 +790,11 @@ class Search {
789790
Указание простого "#" в поиске по названию означает: найти всех авторов, названия книг которых начинаются не с русской или латинской буквы
790791
</li>
791792
<br>
793+
<li>
794+
"~" поиск по регулярному выражению. Например, для "~^\\s" в поле названия, будут найдены
795+
все книги, названия которых начинаются с пробельного символа
796+
</li>
797+
<br>
792798
<li>
793799
"?" поиск пустых значений или тех, что начинаются с этого символа. Например, "?" в поле серии означает: найти всех авторов, у которых есть книги без серий
794800
или название серии начинается с "?".

client/components/Search/SelectExtSearchDialog/SelectExtSearchDialog.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ class SelectExtSearchDialog {
160160
<li>
161161
префикс "#": поиск подстроки в строке, но только среди начинающихся не с латинского или кириллического символа
162162
</li>
163+
<li>
164+
префикс "~": поиск по регулярному выражению
165+
</li>
163166
<li>
164167
префикс "?": поиск пустых значений или тех, что начинаются с этого символа
165168
</li>

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "inpx-web",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"author": "Book Pauk <bookpauk@gmail.com>",
55
"license": "CC0-1.0",
66
"repository": "bookpauk/inpx-web",

server/config/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = {
1818

1919
//поправить в случае, если были критические изменения в DbCreator или InpxParser
2020
//иначе будет рассинхронизация между сервером и клиентом на уровне БД
21-
dbVersion: '10',
21+
dbVersion: '11',
2222
dbCacheSize: 5,
2323

2424
maxPayloadSize: 500,//in MB

server/core/DbCreator.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ class DbCreator {
337337
//сохраним поисковые таблицы
338338
const chunkSize = 10000;
339339

340-
const saveTable = async(table, arr, nullArr, indexType = 'string') => {
340+
const saveTable = async(table, arr, nullArr, indexType = 'string', delEmpty = false) => {
341341

342342
if (indexType == 'string')
343343
arr.sort((a, b) => a.value.localeCompare(b.value));
@@ -366,6 +366,13 @@ class DbCreator {
366366
callback({progress: i/arr.length});
367367
}
368368

369+
if (delEmpty) {
370+
const delResult = await db.delete({table, where: `@@indexLR('value', '?', '?')`});
371+
const statField = `${table}Count`;
372+
if (stats[statField])
373+
stats[statField] -= delResult.deleted;
374+
}
375+
369376
nullArr();
370377
await db.close({table});
371378
utils.freeMemory();
@@ -378,7 +385,7 @@ class DbCreator {
378385

379386
//series
380387
callback({job: 'series save', jobMessage: 'Сохранение индекса серий', jobStep: 4, progress: 0});
381-
await saveTable('series', seriesArr, () => {seriesArr = null});
388+
await saveTable('series', seriesArr, () => {seriesArr = null}, 'string', true);
382389

383390
//title
384391
callback({job: 'title save', jobMessage: 'Сохранение индекса названий', jobStep: 5, progress: 0});

0 commit comments

Comments
 (0)