mirror of
https://github.com/janeczku/calibre-web
synced 2024-09-27 22:58:22 +00:00
add partial token set ratio to db
This commit is contained in:
parent
a936a333a8
commit
cb5e66facd
@ -954,10 +954,10 @@ class CalibreDB:
|
|||||||
|
|
||||||
# read search results from calibre-database and return it (function is used for feed and simple search
|
# 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):
|
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]
|
order = order[0] if order else [Books.sort]
|
||||||
pagination = None
|
pagination = None
|
||||||
result = self.search_query(term, config, *join).order_by(*order).all()
|
result = self.search_query(term, config, *join).order_by(func.desc(func.partial_token_set_ratio(str(Books),term))).all()
|
||||||
sorted(result,key=lambda book:1)
|
|
||||||
for res in result:
|
for res in result:
|
||||||
print(res[0])
|
print(res[0])
|
||||||
result_count = len(result)
|
result_count = len(result)
|
||||||
|
Loading…
Reference in New Issue
Block a user