X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/ad1b85319d1e2e7c58fb923801214c69e6d4ba32..82c3054bcdeb000aa9782da80d644070797b5cbe:/apps/search/templatetags/search_tags.py diff --git a/apps/search/templatetags/search_tags.py b/apps/search/templatetags/search_tags.py index 555edd2fe..8dbad9dae 100644 --- a/apps/search/templatetags/search_tags.py +++ b/apps/search/templatetags/search_tags.py @@ -34,7 +34,7 @@ def book_searched(context, result): hits = filter(lambda (idx, h): result.snippets[idx] is not None or 'fragment' in h, enumerate(result.hits)) - print "[tmpl: from %d hits selected %d]" % (len(result.hits), len(hits)) + # print "[tmpl: from %d hits selected %d]" % (len(result.hits), len(hits)) for (idx, hit) in hits: # currently we generate one snipper per hit though. @@ -43,16 +43,13 @@ def book_searched(context, result): snip = result.snippets[idx] # fix some formattting snip = re.subn(r"(^[ \t\n]+|[ \t\n]+$)", u"", - re.subn(r"[ \t\n]*\n[ \t\n]*", u"\n", snip)) + re.subn(r"[ \t\n]*\n[ \t\n]*", u"\n", snip)[0])[0] snip = snip.replace("\n", "
").replace('---', '—') hit['snippet'] = snip return { - 'related': book.related_info(), + 'request': context['request'], 'book': book, - 'main_link': book.get_absolute_url(), - 'request': context.get('request'), - 'hits': hits and zip(*hits)[1] or [], - 'main_link': book.get_absolute_url(), + 'hits': hits and zip(*hits)[1] or [] }