Paginated search and advanced search
Wraparound on books list deactivated
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user