X-Git-Url: https://git.mdrn.pl/django-migdal.git/blobdiff_plain/e335d8d992b0e8c9f8926c1fe92b3526c3fa1508..6f42e02b4415e5f822739a47a7533cbb96794bcb:/migdal/search_indexes.py diff --git a/migdal/search_indexes.py b/migdal/search_indexes.py index d809e7b..d5b57c0 100644 --- a/migdal/search_indexes.py +++ b/migdal/search_indexes.py @@ -1,4 +1,7 @@ -import datetime +# -*- coding: utf-8 -*- +# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# from django.conf import settings from haystack import indexes from fnpdjango.utils.models.translation import add_translatable_index, localize_field @@ -6,7 +9,8 @@ from migdal.models import Entry class EntryIndex(indexes.SearchIndex, indexes.Indexable): - text = indexes.CharField(null=True, + text = indexes.CharField( + null=True, model_attr=localize_field('body', settings.LANGUAGE_CODE), document=True) date = indexes.DateTimeField(indexed=True, model_attr="date") @@ -15,7 +19,7 @@ class EntryIndex(indexes.SearchIndex, indexes.Indexable): def get_model(self): return Entry - def index_queryset(self): + def index_queryset(self, using=None): """Used when the entire index for model is updated.""" return self.get_model().objects.all()