Commit 107c6c19 authored by Sli's avatar Sli Committed by Skia
Browse files

forum: limit results and improve search engine speed

parent 884855c1
......@@ -54,14 +54,10 @@ class ForumSearchView(ListView):
def get_queryset(self):
query = self.request.GET.get("query", "")
queryset = SearchQuerySet().models(ForumMessage).autocomplete(auto=query)
excluded = [
for o in queryset
if not can_view(o.object.topic, self.request.user)
return [r.object for r in queryset]
queryset = SearchQuerySet().models(ForumMessage).autocomplete(auto=query)[:100]
return [
r.object for r in queryset if can_view(r.object.topic, self.request.user)
class ForumMainView(ListView):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment