From: Jan Szejko Date: Tue, 31 Oct 2017 13:27:29 +0000 (+0100) Subject: anchor filter-books param parts at word beginning X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/79b14c35807e7b5af5efaa51d780b64b684ba04f?ds=sidebyside anchor filter-books param parts at word beginning --- diff --git a/src/api/handlers.py b/src/api/handlers.py index a869e5845..27477b3b2 100644 --- a/src/api/handlers.py +++ b/src/api/handlers.py @@ -276,9 +276,9 @@ class FilterBooksHandler(AnonymousBooksHandler): is_audiobook = is_audiobook == 'true' books = Book.objects.distinct() if title_part: - books = books.filter(title__icontains=title_part) + books = books.filter(title__iregex='\m' + title_part) if author_part is not None: - books = books.filter(cached_author__icontains=author_part) + books = books.filter(cached_author__iregex='\m' + author_part) if is_lektura is not None: books = books.filter(has_audience=is_lektura) if is_audiobook is not None: