Skip to content

Commit

Permalink
Add search term limit
Browse files Browse the repository at this point in the history
  • Loading branch information
garethbjohnson committed Jan 2, 2022
1 parent 25e0063 commit b81b7d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion books/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def get_queryset(self):
search_string = self.request.GET.get('search')
if search_string is not None:
search_terms = search_string.split(' ')
for term in search_terms:
for term in search_terms[:32]:
queryset = queryset.filter(
Q(authors__name__icontains=term) | Q(title__icontains=term)
)
Expand Down

0 comments on commit b81b7d7

Please sign in to comment.