mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 08:36:32 +00:00
commit
fba9e0fdb6
2 changed files with 4 additions and 2 deletions
|
@ -15,6 +15,8 @@ class ConnectorException(HTTPError):
|
||||||
|
|
||||||
def search(query, min_confidence=0.1):
|
def search(query, min_confidence=0.1):
|
||||||
""" find books based on arbitary keywords """
|
""" find books based on arbitary keywords """
|
||||||
|
if not query:
|
||||||
|
return []
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
# Have we got a ISBN ?
|
# Have we got a ISBN ?
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Search(View):
|
||||||
return JsonResponse([r.json() for r in book_results], safe=False)
|
return JsonResponse([r.json() for r in book_results], safe=False)
|
||||||
|
|
||||||
# use webfinger for mastodon style account@domain.com username
|
# use webfinger for mastodon style account@domain.com username
|
||||||
if re.match(r"\B%s" % regex.full_username, query):
|
if query and re.match(regex.full_username, query):
|
||||||
handle_remote_webfinger(query)
|
handle_remote_webfinger(query)
|
||||||
|
|
||||||
# do a user search
|
# do a user search
|
||||||
|
@ -73,6 +73,6 @@ class Search(View):
|
||||||
"book_results": book_results,
|
"book_results": book_results,
|
||||||
"user_results": user_results,
|
"user_results": user_results,
|
||||||
"list_results": list_results,
|
"list_results": list_results,
|
||||||
"query": query,
|
"query": query or "",
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, "search_results.html", data)
|
return TemplateResponse(request, "search_results.html", data)
|
||||||
|
|
Loading…
Reference in a new issue