Paginated search and advanced search

Wraparound on books list deactivated
This commit is contained in:
Ozzieisaacs
2020-10-04 19:23:06 +02:00
parent e3f4f24c3e
commit 6e6f144b7a
5 changed files with 61 additions and 33 deletions
+5 -2
View File
@@ -648,9 +648,10 @@ class CalibreDB():
# read search results from calibre-database and return it (function is used for feed and simple search
def get_search_results(self, term, offset=None, order=None, limit=None):
order = order or [Books.sort]
pagination = None
if offset != None and limit != None:
offset = int(offset)
limit = offset + int(limit)
limit_all = offset + int(limit)
term.strip().lower()
self.session.connection().connection.connection.create_function("lower", 1, lcase)
q = list()
@@ -665,7 +666,9 @@ class CalibreDB():
func.lower(Books.title).ilike("%" + term + "%")
)).order_by(*order).all()
result_count = len(result)
return result[offset:limit], result_count
if offset != None and limit != None:
pagination = Pagination((offset / (int(limit)) + 1), limit, result_count)
return result[offset:limit_all], result_count, pagination
# Creates for all stored languages a translated speaking name in the array for the UI
def speaking_language(self, languages=None):