From 90cb91063ad7e00060c1ceb3845a1bff2cb468d5 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Fri, 16 Aug 2019 10:04:48 -0300 Subject: [PATCH] =?UTF-8?q?Inclui=20campo=20para=20ordena=C3=A7=C3=A3o=20v?= =?UTF-8?q?ia=20datas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/base/search_indexes.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sapl/base/search_indexes.py b/sapl/base/search_indexes.py index d2acb7c8e..4f2b7a553 100644 --- a/sapl/base/search_indexes.py +++ b/sapl/base/search_indexes.py @@ -1,23 +1,21 @@ -import os.path import logging +import os.path +from celery_haystack.indexes import CelerySearchIndex from django.db.models import F, Q, Value from django.db.models.fields import TextField from django.db.models.functions import Concat from django.template import loader from haystack import connections from haystack.constants import Indexable -from haystack.fields import CharField +from haystack.fields import CharField, DateTimeField from haystack.utils import get_model_ct_tuple -from celery_haystack.indexes import CelerySearchIndex - from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC, STATUS_TA_PUBLIC, Dispositivo) from sapl.materia.models import DocumentoAcessorio, MateriaLegislativa from sapl.norma.models import NormaJuridica from sapl.settings import SOLR_URL -from sapl.utils import RemoveTag class TextExtractField(CharField): @@ -120,6 +118,7 @@ class TextExtractField(CharField): class DocumentoAcessorioIndex(CelerySearchIndex, Indexable): model = DocumentoAcessorio + index_date = DateTimeField(model_attr='data') text = TextExtractField( document=True, use_template=True, model_attr=( @@ -145,6 +144,7 @@ class DocumentoAcessorioIndex(CelerySearchIndex, Indexable): class NormaJuridicaIndex(DocumentoAcessorioIndex): model = NormaJuridica + index_date = DateTimeField(model_attr='data') text = TextExtractField( document=True, use_template=True, model_attr=( @@ -159,6 +159,7 @@ class NormaJuridicaIndex(DocumentoAcessorioIndex): class MateriaLegislativaIndex(DocumentoAcessorioIndex): model = MateriaLegislativa + index_date = DateTimeField(model_attr='data_apresentacao') text = TextExtractField( document=True, use_template=True, model_attr=(