diff --git a/client/components/Search/Search.vue b/client/components/Search/Search.vue
index 90d71e9..b91d940 100644
--- a/client/components/Search/Search.vue
+++ b/client/components/Search/Search.vue
@@ -160,7 +160,7 @@
@@ -171,6 +171,21 @@
{{ librateNames }}
+
+
+
+
+
+
+
+
+ {{ search.ext }}
+
+
+{{ extendedParamsMessage }}
@@ -331,6 +346,7 @@
+
@@ -351,6 +367,7 @@ import SelectGenreDialog from './SelectGenreDialog/SelectGenreDialog.vue';
import SelectLangDialog from './SelectLangDialog/SelectLangDialog.vue';
import SelectLibRateDialog from './SelectLibRateDialog/SelectLibRateDialog.vue';
import SelectDateDialog from './SelectDateDialog/SelectDateDialog.vue';
+import SelectExtDialog from './SelectExtDialog/SelectExtDialog.vue';
import BookInfoDialog from './BookInfoDialog/BookInfoDialog.vue';
import SelectExtSearchDialog from './SelectExtSearchDialog/SelectExtSearchDialog.vue';
@@ -384,6 +401,7 @@ const componentOptions = {
SelectLangDialog,
SelectLibRateDialog,
SelectDateDialog,
+ SelectExtDialog,
BookInfoDialog,
SelectExtSearchDialog,
Dialog,
@@ -495,6 +513,7 @@ class Search {
selectLangDialogVisible = false;
selectLibRateDialogVisible = false;
selectDateDialogVisible = false;
+ selectExtDialogVisible = false;
bookInfoDialogVisible = false;
selectExtSearchDialogVisible = false;
@@ -531,6 +550,7 @@ class Search {
genreTree = [];
genreMap = new Map();
langList = [];
+ extList = [];
genreTreeInpxHash = '';
showTooltips = true;
@@ -561,7 +581,7 @@ class Search {
this.commit = this.$store.commit;
this.api = this.$root.api;
- this.generateDefaults(this.search, ['author', 'series', 'title', 'genre', 'lang', 'date', 'librate']);
+ this.generateDefaults(this.search, ['author', 'series', 'title', 'genre', 'lang', 'date', 'librate', 'ext']);
this.search.setDefaults(this.search);
this.loadSettings();
@@ -941,6 +961,11 @@ class Search {
this.selectLibRateDialogVisible = true;
}
+ selectExt() {
+ this.hideTooltip();
+ this.selectExtDialogVisible = true;
+ }
+
selectExtSearch() {
this.hideTooltip();
this.selectExtSearchDialogVisible = true;
@@ -1170,6 +1195,7 @@ class Search {
}
this.langList = result.langList;
+ this.extList = result.extList;
this.genreTreeInpxHash = result.inpxHash;
}
} catch (e) {
diff --git a/client/components/Search/SelectExtDialog/SelectExtDialog.vue b/client/components/Search/SelectExtDialog/SelectExtDialog.vue
new file mode 100644
index 0000000..5622105
--- /dev/null
+++ b/client/components/Search/SelectExtDialog/SelectExtDialog.vue
@@ -0,0 +1,175 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/server/config/base.js b/server/config/base.js
index 2cf732b..71eaa92 100644
--- a/server/config/base.js
+++ b/server/config/base.js
@@ -21,7 +21,7 @@ module.exports = {
//поправить в случае, если были критические изменения в DbCreator или InpxParser
//иначе будет рассинхронизация по кешу между сервером и клиентом на уровне БД
- dbVersion: '11',
+ dbVersion: '12',
dbCacheSize: 5,
maxPayloadSize: 500,//in MB
diff --git a/server/core/DbCreator.js b/server/core/DbCreator.js
index 4066ff7..841eeee 100644
--- a/server/core/DbCreator.js
+++ b/server/core/DbCreator.js
@@ -64,6 +64,8 @@ class DbCreator {
let dateArr = [];
let librateMap = new Map();//оценка
let librateArr = [];
+ let extMap = new Map();//тип файла
+ let extArr = [];
let uidSet = new Set();//уникальные идентификаторы
@@ -215,6 +217,9 @@ class DbCreator {
//оценка
parseField(rec.librate, librateMap, librateArr, rec.id);
+
+ //тип файла
+ parseField(rec.ext, extMap, extArr, rec.id);
};
//основная процедура парсинга
@@ -272,6 +277,8 @@ class DbCreator {
delMap = null;
dateMap = null;
librateMap = null;
+ extMap = null;
+
uidSet = null;
await db.close({table: 'book'});
@@ -408,6 +415,9 @@ class DbCreator {
//librate
await saveTable('librate', librateArr, () => {librateArr = null}, 'number');
+ //ext
+ await saveTable('ext', extArr, () => {extArr = null});
+
//кэш-таблицы запросов
await db.create({table: 'query_cache'});
await db.create({table: 'query_time'});
diff --git a/server/core/DbSearcher.js b/server/core/DbSearcher.js
index 79cceb2..8bd36e8 100644
--- a/server/core/DbSearcher.js
+++ b/server/core/DbSearcher.js
@@ -288,6 +288,42 @@ class DbSearcher {
idsArr.push(ids);
}
+ //тип файла
+ if (query.ext) {
+ const key = `book-ids-ext-${query.ext}`;
+ let ids = await this.getCached(key);
+
+ if (ids === null) {
+ const extRows = await db.select({
+ table: 'ext',
+ rawResult: true,
+ where: `
+ const exts = ${db.esc(query.ext.split(','))};
+
+ const ids = new Set();
+ for (const l of exts) {
+ for (const id of @indexLR('value', l, l))
+ ids.add(id);
+ }
+
+ const result = new Set();
+ for (const id of ids) {
+ const row = @unsafeRow(id);
+ for (const bookId of row.bookIds)
+ result.add(bookId);
+ }
+
+ return new Uint32Array(result);
+ `
+ });
+
+ ids = extRows[0].rawResult;
+ await this.putCached(key, ids);
+ }
+
+ idsArr.push(ids);
+ }
+
if (idsArr.length > 1) {
//ищем пересечение множеств
let proc = 0;
diff --git a/server/core/WebWorker.js b/server/core/WebWorker.js
index abffb56..317ee89 100644
--- a/server/core/WebWorker.js
+++ b/server/core/WebWorker.js
@@ -350,9 +350,14 @@ class WebWorker {
rows = await db.select({table: 'lang', map: `(r) => ({value: r.value})`});
const langs = rows.map(r => r.value);
+ // exts
+ rows = await db.select({table: 'ext', map: `(r) => ({value: r.value})`});
+ const exts = rows.map(r => r.value);
+
result = {
genreTree: genres,
langList: langs,
+ extList: exts,
inpxHash: (config.inpxHash ? config.inpxHash : ''),
};