forked from mirrors/bookwyrm
Updates other calls to the search endpoint
This commit is contained in:
parent
98325818b2
commit
0d5e05a3c2
3 changed files with 6 additions and 9 deletions
|
@ -11,8 +11,7 @@ from django.template.response import TemplateResponse
|
|||
from django.utils.decorators import method_decorator
|
||||
from django.views import View
|
||||
|
||||
from bookwyrm import forms, models
|
||||
from bookwyrm.connectors import connector_manager
|
||||
from bookwyrm import book_search, forms, models
|
||||
from bookwyrm.suggested_users import suggested_users
|
||||
from .edit_user import save_user_form
|
||||
|
||||
|
@ -55,7 +54,7 @@ class GetStartedBooks(View):
|
|||
query = request.GET.get("query")
|
||||
book_results = popular_books = []
|
||||
if query:
|
||||
book_results = connector_manager.local_search(query, raw=True)[:5]
|
||||
book_results = book_search.search(query)[:5]
|
||||
if len(book_results) < 5:
|
||||
popular_books = (
|
||||
models.Edition.objects.exclude(
|
||||
|
|
|
@ -4,7 +4,7 @@ from django.http import JsonResponse
|
|||
from django.template.response import TemplateResponse
|
||||
from django.views import View
|
||||
|
||||
from bookwyrm.connectors import connector_manager
|
||||
from bookwyrm import book_search
|
||||
from bookwyrm.settings import PAGE_LENGTH
|
||||
from .helpers import is_api_request
|
||||
|
||||
|
@ -14,7 +14,7 @@ class Isbn(View):
|
|||
|
||||
def get(self, request, isbn):
|
||||
"""info about a book"""
|
||||
book_results = connector_manager.isbn_local_search(isbn)
|
||||
book_results = book_search.isbn_search(isbn)
|
||||
|
||||
if is_api_request(request):
|
||||
return JsonResponse([r.json() for r in book_results], safe=False)
|
||||
|
|
|
@ -16,9 +16,8 @@ from django.utils.decorators import method_decorator
|
|||
from django.views import View
|
||||
from django.views.decorators.http import require_POST
|
||||
|
||||
from bookwyrm import forms, models
|
||||
from bookwyrm import book_search, forms, models
|
||||
from bookwyrm.activitypub import ActivitypubResponse
|
||||
from bookwyrm.connectors import connector_manager
|
||||
from bookwyrm.settings import PAGE_LENGTH
|
||||
from .helpers import is_api_request, privacy_filter
|
||||
from .helpers import get_user_from_username
|
||||
|
@ -150,9 +149,8 @@ class List(View):
|
|||
|
||||
if query and request.user.is_authenticated:
|
||||
# search for books
|
||||
suggestions = connector_manager.local_search(
|
||||
suggestions = book_search.search(
|
||||
query,
|
||||
raw=True,
|
||||
filters=[~Q(parent_work__editions__in=book_list.books.all())],
|
||||
)
|
||||
elif request.user.is_authenticated:
|
||||
|
|
Loading…
Reference in a new issue