Closed davegri closed 8 years ago
I've just pushed up a commit to master that should fix this.
On Tue, 6 Oct 2015 at 18:05 David Griver notifications@github.com wrote:
I have the following configuration:
class CrawlersConfig(AppConfig): name = "crawlers" def ready(self): Image = self.get_model("Image") watson.register(Image, fields=('tagsname',), store=('thumbnailurl', 'page_url', 'source_url', 'get_origin_display', 'tags__name'))
According to the docs I just need to add the watson middleware in order for a change in the manytomany fields to update the index. I added it but it still doesn't update when I add or remove tags to my images.
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/131.
It's still not working, also it dosen't create a new index for new objects, is it supposed to? how do I automatically index every new object I add?
I assume that you've set the app config as the default app config for your app?
On Wed, 7 Oct 2015 at 14:27 David Griver notifications@github.com wrote:
It's still not working, also it dosen't create a new index for new objects, is it supposed to? how do I automatically index every new object I add?
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/131#issuecomment-146195992 .
I think so, can you elaborate?
In the init.py of the app, you need something along the lines of:
DEFAULT_APP_CONFIG = "yourapp.apps.YourAppConfig"
Easy check, put a print("foo") in your ready() method to ensure its executed! On Wed, 7 Oct 2015 at 21:26, David Griver notifications@github.com wrote:
I think so, can you elaborate?
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/131#issuecomment-146317901 .
Yeah, the models wouldn't be registered otherwise so I have that.
If your models are registered, then calling save() on the model will create a new SearchEntry in the database. The change I pushed ot master was also adding to the SearchEntry index when the M2M fields are changed.
If that's not happening, then I don't think your models are being registered. Some print("foo") around the registration code will verify if this is the case,
On Thu, 8 Oct 2015 at 07:58 David Griver notifications@github.com wrote:
Yeah, the models wouldn't be registered otherwise so I have that.
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/131#issuecomment-146438421 .
I have the following configuration:
According to the docs I just need to add the watson middleware in order for a change in the manytomany fields to update the index. I added it but it still doesn't update when I add or remove tags to my images.