+ def search_by_author(self, words):
+ from catalogue.models import Book
+ books = Book.objects.filter(parent=None).order_by('-popularity__count')
+ for word in words:
+ books = books.filter(cached_author__iregex='\m%s\M' % word).select_related('popularity__count')
+ return [SearchResult.from_book(book, how_found='search_by_author', query_terms=words) for book in books[:30]]
+