Работа над новым поиском
This commit is contained in:
@@ -181,7 +181,7 @@ class SeriesList extends BaseList {
|
||||
let result = [];
|
||||
|
||||
const expandedSet = new Set(this.expandedSeries);
|
||||
const series = this.searchResult.series;
|
||||
const series = this.searchResult.found;
|
||||
if (!series)
|
||||
return;
|
||||
|
||||
@@ -256,13 +256,13 @@ class SeriesList extends BaseList {
|
||||
this.queryExecute = null;
|
||||
|
||||
try {
|
||||
const result = await this.api.seriesSearch(query);
|
||||
const response = await this.api.search('series', query);
|
||||
|
||||
this.list.queryFound = result.series.length;
|
||||
this.list.totalFound = result.totalFound;
|
||||
this.list.inpxHash = result.inpxHash;
|
||||
this.list.queryFound = response.found.length;
|
||||
this.list.totalFound = response.totalFound;
|
||||
this.list.inpxHash = response.inpxHash;
|
||||
|
||||
this.searchResult = result;
|
||||
this.searchResult = response;
|
||||
|
||||
await utils.sleep(1);
|
||||
if (!this.queryExecute) {
|
||||
|
||||
@@ -49,7 +49,7 @@ class TitleList extends BaseList {
|
||||
async updateTableData() {
|
||||
let result = [];
|
||||
|
||||
const title = this.searchResult.title;
|
||||
const title = this.searchResult.found;
|
||||
if (!title)
|
||||
return;
|
||||
|
||||
@@ -116,13 +116,13 @@ class TitleList extends BaseList {
|
||||
this.queryExecute = null;
|
||||
|
||||
try {
|
||||
const result = await this.api.titleSearch(query);
|
||||
const response = await this.api.search('title', query);
|
||||
|
||||
this.list.queryFound = result.title.length;
|
||||
this.list.totalFound = result.totalFound;
|
||||
this.list.inpxHash = result.inpxHash;
|
||||
this.list.queryFound = response.found.length;
|
||||
this.list.totalFound = response.totalFound;
|
||||
this.list.inpxHash = response.inpxHash;
|
||||
|
||||
this.searchResult = result;
|
||||
this.searchResult = response;
|
||||
|
||||
await utils.sleep(1);
|
||||
if (!this.queryExecute) {
|
||||
|
||||
@@ -318,8 +318,8 @@ class DbSearcher {
|
||||
async filterTableIds(tableIds, from, query) {
|
||||
let result = tableIds;
|
||||
|
||||
//т.к. авторы идут списком, то дополнительно фильтруем
|
||||
if (query.author && query.author !== '*') {
|
||||
//т.к. авторы у книги идут списком, то дополнительно фильтруем
|
||||
if (from == 'author' && query.author && query.author !== '*') {
|
||||
const key = `filter-ids-author-${query.author}`;
|
||||
let authorIds = await this.getCached(key);
|
||||
|
||||
@@ -591,18 +591,24 @@ class DbSearcher {
|
||||
}
|
||||
}
|
||||
|
||||
//кладем в таблицу
|
||||
await db.insert({
|
||||
table: 'query_cache',
|
||||
replace: true,
|
||||
rows: [{id: key, value}],
|
||||
});
|
||||
//кладем в таблицу асинхронно
|
||||
(async() => {
|
||||
try {
|
||||
await db.insert({
|
||||
table: 'query_cache',
|
||||
replace: true,
|
||||
rows: [{id: key, value}],
|
||||
});
|
||||
|
||||
await db.insert({
|
||||
table: 'query_time',
|
||||
replace: true,
|
||||
rows: [{id: key, time: Date.now()}],
|
||||
});
|
||||
await db.insert({
|
||||
table: 'query_time',
|
||||
replace: true,
|
||||
rows: [{id: key, time: Date.now()}],
|
||||
});
|
||||
} catch(e) {
|
||||
console.error(`putCached: ${e.message}`);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
async periodicCleanCache() {
|
||||
|
||||
Reference in New Issue
Block a user