+ )[:100]
+ snippets_by_book = {}
+ for snippet in snippets:
+ snippet_list = snippets_by_book.setdefault(snippet.book, [])
+ if len(snippet_list) < 3:
+ snippet_list.append(snippet)
+
+ return {
+ 'author': qs['author'].annotate(
+ search_vector=UnaccentSearchVector('name_pl')
+ ).filter(search_vector=squery),
+ 'theme': qs['theme'].annotate(
+ search_vector=UnaccentSearchVector('name_pl')
+ ).filter(search_vector=squery),
+ 'genre': qs['genre'].annotate(
+ search_vector=UnaccentSearchVector('name_pl')
+ ).filter(search_vector=squery),
+ 'collection': qs['collection'].annotate(
+ search_vector=UnaccentSearchVector('title')
+ ).filter(search_vector=squery),
+ 'book': books[:100],
+ 'art': qs['art'].annotate(
+ search_vector=UnaccentSearchVector('title')
+ ).filter(search_vector=squery)[:100],
+ 'snippet': snippets_by_book,
+ 'pdauthor': pdcounter.models.Author.search(squery, qs=qs['pdauthor']),
+ 'pdbook': pdcounter.models.BookStub.search(squery, qs=qs['pdbook']),