Browse Source

Introduz o RealtimeSignalProcessor

pull/1276/head
Edward Ribeiro 8 years ago
parent
commit
71491c33dd
  1. 5
      sapl/materia/signals.py
  2. 3
      sapl/norma/signals.py
  3. 1
      sapl/settings.py
  4. 17
      sapl/utils.py

5
sapl/materia/signals.py

@ -8,8 +8,3 @@ from .models import DocumentoAcessorio, MateriaLegislativa
tramitacao_signal = django.dispatch.Signal(providing_args=['post', 'request']) tramitacao_signal = django.dispatch.Signal(providing_args=['post', 'request'])
# post_save.connect(save_texto, sender=MateriaLegislativa)
# post_save.connect(save_texto, sender=DocumentoAcessorio)
# post_delete.connect(delete_texto, sender=MateriaLegislativa)
# post_delete.connect(delete_texto, sender=DocumentoAcessorio)

3
sapl/norma/signals.py

@ -3,6 +3,3 @@ from django.db.models.signals import post_delete, post_save
from sapl.utils import delete_texto, save_texto from sapl.utils import delete_texto, save_texto
from .models import NormaJuridica from .models import NormaJuridica
# post_save.connect(save_texto, sender=NormaJuridica)
# post_delete.connect(delete_texto, sender=NormaJuridica)

1
sapl/settings.py

@ -86,6 +86,7 @@ INSTALLED_APPS = (
) + SAPL_APPS ) + SAPL_APPS
# FTS = Full Text Search # FTS = Full Text Search
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
SEARCH_BACKEND = 'haystack.backends.whoosh_backend.WhooshEngine' SEARCH_BACKEND = 'haystack.backends.whoosh_backend.WhooshEngine'
SEARCH_URL = ('PATH', PROJECT_DIR.child('whoosh')) SEARCH_URL = ('PATH', PROJECT_DIR.child('whoosh'))

17
sapl/utils.py

@ -553,20 +553,3 @@ def texto_upload_path(instance, filename, subpath='', pk_first=False):
} }
return path return path
class UpdateIndexCommand(Thread):
def run(self):
call([PROJECT_DIR.child('manage.py'), 'update_index'],
stdout=PIPE)
def save_texto(sender, instance, **kwargs):
update_index = UpdateIndexCommand()
update_index.start()
def delete_texto(sender, instance, **kwargs):
update_index = UpdateIndexCommand()
update_index.start()

Loading…
Cancel
Save