|
@ -7,7 +7,8 @@ from django.db.models.functions import Concat |
|
|
from django.template import loader |
|
|
from django.template import loader |
|
|
from haystack import connections |
|
|
from haystack import connections |
|
|
from haystack.constants import Indexable |
|
|
from haystack.constants import Indexable |
|
|
from haystack.fields import CharField |
|
|
from haystack.fields import CharField, IntegerField, FacetCharField, \ |
|
|
|
|
|
FacetIntegerField, FacetDateField |
|
|
from haystack.indexes import SearchIndex |
|
|
from haystack.indexes import SearchIndex |
|
|
from haystack.utils import get_model_ct_tuple |
|
|
from haystack.utils import get_model_ct_tuple |
|
|
|
|
|
|
|
@ -119,6 +120,8 @@ class TextExtractField(CharField): |
|
|
|
|
|
|
|
|
class DocumentoAcessorioIndex(SearchIndex, Indexable): |
|
|
class DocumentoAcessorioIndex(SearchIndex, Indexable): |
|
|
model = DocumentoAcessorio |
|
|
model = DocumentoAcessorio |
|
|
|
|
|
tipo = FacetCharField(model_attr='tipo__descricao') |
|
|
|
|
|
data = FacetDateField(model_attr='data') |
|
|
text = TextExtractField( |
|
|
text = TextExtractField( |
|
|
document=True, use_template=True, |
|
|
document=True, use_template=True, |
|
|
model_attr=( |
|
|
model_attr=( |
|
@ -144,6 +147,9 @@ class DocumentoAcessorioIndex(SearchIndex, Indexable): |
|
|
|
|
|
|
|
|
class NormaJuridicaIndex(DocumentoAcessorioIndex): |
|
|
class NormaJuridicaIndex(DocumentoAcessorioIndex): |
|
|
model = NormaJuridica |
|
|
model = NormaJuridica |
|
|
|
|
|
ano = FacetIntegerField(model_attr='ano') |
|
|
|
|
|
tipo = FacetCharField(model_attr='tipo__sigla') |
|
|
|
|
|
data = FacetDateField(model_attr='data', null=True) |
|
|
text = TextExtractField( |
|
|
text = TextExtractField( |
|
|
document=True, use_template=True, |
|
|
document=True, use_template=True, |
|
|
model_attr=( |
|
|
model_attr=( |
|
@ -158,6 +164,9 @@ class NormaJuridicaIndex(DocumentoAcessorioIndex): |
|
|
|
|
|
|
|
|
class MateriaLegislativaIndex(DocumentoAcessorioIndex): |
|
|
class MateriaLegislativaIndex(DocumentoAcessorioIndex): |
|
|
model = MateriaLegislativa |
|
|
model = MateriaLegislativa |
|
|
|
|
|
ano = FacetIntegerField(model_attr='ano') |
|
|
|
|
|
tipo = FacetCharField(model_attr='tipo__sigla') |
|
|
|
|
|
data = FacetDateField(model_attr='data_publicacao') |
|
|
text = TextExtractField( |
|
|
text = TextExtractField( |
|
|
document=True, use_template=True, |
|
|
document=True, use_template=True, |
|
|
model_attr=( |
|
|
model_attr=( |
|
|