From 277c0c4bfe67b3202542f2c8e5ec12580aad7052 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 2 Nov 2020 08:48:58 -0800 Subject: [PATCH 1/3] Hide search results from external datasources --- bookwyrm/templates/search_results.html | 72 ++++++++++++++++++-------- 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/bookwyrm/templates/search_results.html b/bookwyrm/templates/search_results.html index bd5096fe..6c712349 100644 --- a/bookwyrm/templates/search_results.html +++ b/bookwyrm/templates/search_results.html @@ -3,30 +3,60 @@

Matching Books

- {% for result_set in book_results %} - {% if result_set.results %} -
- {% if not result_set.connector.local %} -

- Results from {% if result_set.connector.name %}{{ result_set.connector.name }}{% else %}{{ result_set.connector.identifier }}{% endif %} -

- {% endif %} - +
+
- {% endif %} - {% endfor %} - {% if not book_results %} -

No books found for "{{ query }}"

- {% endif %} + +
+

+ Didn't find what you were looking for? +

+ + + +
+ + +

Matching Users

From 485f3831b912cd3d7a5005bf6f1ec8fbb53eea65 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 2 Nov 2020 08:50:21 -0800 Subject: [PATCH 2/3] Priortize other instances over openlibrary --- bookwyrm/books_manager.py | 2 +- init_db.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bookwyrm/books_manager.py b/bookwyrm/books_manager.py index 37a31766..461017a0 100644 --- a/bookwyrm/books_manager.py +++ b/bookwyrm/books_manager.py @@ -50,7 +50,7 @@ def get_or_create_connector(remote_id): books_url='https://%s/book' % identifier, covers_url='https://%s/images/covers' % identifier, search_url='https://%s/search?q=' % identifier, - priority=3 + priority=2 ) return load_connector(connector_info) diff --git a/init_db.py b/init_db.py index ef11f8c5..a7a45c20 100644 --- a/init_db.py +++ b/init_db.py @@ -76,4 +76,5 @@ Connector.objects.create( books_url='https://openlibrary.org', covers_url='https://covers.openlibrary.org', search_url='https://openlibrary.org/search?q=', + priority=3, ) From 903e68f64a5c4eadcbfc6343ee3da5bd9dbbe81a Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 2 Nov 2020 09:03:48 -0800 Subject: [PATCH 3/3] Show extended search results automatically for empty local results --- bookwyrm/templates/search_results.html | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/bookwyrm/templates/search_results.html b/bookwyrm/templates/search_results.html index 6c712349..14e5fbbd 100644 --- a/bookwyrm/templates/search_results.html +++ b/bookwyrm/templates/search_results.html @@ -1,20 +1,24 @@ {% extends 'layout.html' %} {% block content %} +{% with book_results|first as local_results %}

Matching Books

+ {% if not local_results.results %} +

No books found for "{{ query }}"

+ {% else %} + {% endif %}
+ {% if book_results|slice:":1" and local_results.results %}

Didn't find what you were looking for? @@ -25,8 +29,9 @@

+ {% endif %} - +
@@ -72,4 +76,5 @@ {% endfor %}
+{% endwith %} {% endblock %}