mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Adapt forum search to xapian and improve query
This commit is contained in:
parent
9b8a881914
commit
286ba91c75
@ -27,7 +27,7 @@ from django.conf import settings
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
from django.contrib.auth import get_user
|
||||
from django.contrib.auth.middleware import (
|
||||
AuthenticationMiddleware as DjangoAuthenticationMiddleware
|
||||
AuthenticationMiddleware as DjangoAuthenticationMiddleware,
|
||||
)
|
||||
|
||||
module, klass = settings.AUTH_ANONYMOUS_MODEL.rsplit(".", 1)
|
||||
|
@ -1 +1,4 @@
|
||||
{{ object.topic }}
|
||||
{{ object.title }}
|
||||
{{ object.message }}
|
||||
{{ object.author }}
|
||||
|
@ -47,7 +47,7 @@ class ForumSearchView(ListView):
|
||||
|
||||
def get_queryset(self):
|
||||
query = self.request.GET.get("query", "")
|
||||
q = SearchQuerySet().models(ForumMessage).filter(text=query)
|
||||
q = SearchQuerySet().models(ForumMessage).filter_or(text__contains=query)
|
||||
return [r.object for r in q]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user