Fix for (#2802) search request fails with error after browser session closed and currently returns all results

This commit is contained in:
Ozzie Isaacs 2023-06-05 14:41:03 +02:00
parent 33e35eeb52
commit 860443079d
2 changed files with 14 additions and 8 deletions

View File

@ -375,13 +375,19 @@ def render_prepare_search_form(cc):
def render_search_results(term, offset=None, order=None, limit=None): def render_search_results(term, offset=None, order=None, limit=None):
join = db.books_series_link, db.Books.id == db.books_series_link.c.book, db.Series if term:
entries, result_count, pagination = calibre_db.get_search_results(term, join = db.books_series_link, db.Books.id == db.books_series_link.c.book, db.Series
config, entries, result_count, pagination = calibre_db.get_search_results(term,
offset, config,
order, offset,
limit, order,
*join) limit,
*join)
else:
entries = list()
order = [None, None]
pagination = result_count = None
return render_title_template('search.html', return render_title_template('search.html',
searchterm=term, searchterm=term,
pagination=pagination, pagination=pagination,

View File

@ -396,7 +396,7 @@ def render_books_list(data, sort_param, book_id, page):
elif data == "archived": elif data == "archived":
return render_archived_books(page, order) return render_archived_books(page, order)
elif data == "search": elif data == "search":
term = (request.args.get('query') or '') term = request.args.get('query', None)
offset = int(int(config.config_books_per_page) * (page - 1)) offset = int(int(config.config_books_per_page) * (page - 1))
return render_search_results(term, offset, order, config.config_books_per_page) return render_search_results(term, offset, order, config.config_books_per_page)
elif data == "advsearch": elif data == "advsearch":