I want to include a custom field in the watson model SearchEntry as almost all my searches will include it.
I've created a custom engine that creates a new field and index on install and linked to in settings:
WATSON_BACKEND = "tools.custombackend.SearchBackend"
I can see how I am going to include it in the search by creating a custom SearchAdapter that is setup with I register the models.
However, I can't work out how to get my value into the model. I thought I could use signals, but it's never getting triggered.
This is signals.py
from django.db.models.signals import pre_save, pre_delete, post_save, post_delete
from django.dispatch import receiver
from django.conf import settings
from watson.models import SearchEntry
@receiver(post_save, sender=SearchEntry)
def model_post_save(sender, **kwargs):
never gets here....
and I'm calling it from one of the apps.py that I know is getting triggered.
class ToolsAppConfig(AppConfig):
name = "tools"
def ready(self):
print 'loading signals'
import tools.signals
Have I setup the signal receiver incorrectly? Maybe there is a better way? The value I want to save in searchentry is in the object being indexed.