Работа над расширенным поиском
This commit is contained in:
@@ -113,16 +113,19 @@ export default class BaseList {
|
||||
}
|
||||
|
||||
selectAuthor(author) {
|
||||
this.search.author = `=${author}`;
|
||||
const search = (this.isExtendedSearch ? this.extSearch : this.search);
|
||||
search.author = `=${author}`;
|
||||
this.scrollToTop();
|
||||
}
|
||||
|
||||
selectSeries(series) {
|
||||
this.search.series = `=${series}`;
|
||||
const search = (this.isExtendedSearch ? this.extSearch : this.search);
|
||||
search.series = `=${series}`;
|
||||
}
|
||||
|
||||
selectTitle(title) {
|
||||
this.search.title = `=${title}`;
|
||||
const search = (this.isExtendedSearch ? this.extSearch : this.search);
|
||||
search.title = `=${title}`;
|
||||
}
|
||||
|
||||
async download(book, action) {
|
||||
|
||||
@@ -608,10 +608,23 @@ class DbSearcher {
|
||||
for (const id of @all()) {
|
||||
const row = @unsafeRow(id);
|
||||
if (checkBook(row))
|
||||
result.push(row.id);
|
||||
result.push(row);
|
||||
}
|
||||
|
||||
return new Uint32Array(result);
|
||||
result.sort((a, b) => {
|
||||
let cmp = a.author.localeCompare(b.author);
|
||||
if (cmp === 0 && (a.series || b.series)) {
|
||||
cmp = (a.series && b.series ? a.series.localeCompare(b.series) : (a.series ? -1 : 1));
|
||||
}
|
||||
if (cmp === 0)
|
||||
cmp = a.serno - b.serno;
|
||||
if (cmp === 0)
|
||||
cmp = a.title.localeCompare(b.title);
|
||||
|
||||
return cmp;
|
||||
});
|
||||
|
||||
return new Uint32Array(result.map(row => row.id));
|
||||
`
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user