1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-13 05:20:01 +00:00

add partial token set ratio to db

This commit is contained in:
Daniel 2023-05-28 13:11:50 +02:00
parent a936a333a8
commit cb5e66facd

View File

@ -954,10 +954,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, config, offset=None, order=None, limit=None, *join):
self.session.connection().connection.connection.create_function("partial_token_set_ratio", 2, partial_token_set_ratio)
order = order[0] if order else [Books.sort]
pagination = None
result = self.search_query(term, config, *join).order_by(*order).all()
sorted(result,key=lambda book:1)
result = self.search_query(term, config, *join).order_by(func.desc(func.partial_token_set_ratio(str(Books),term))).all()
for res in result:
print(res[0])
result_count = len(result)