divio / aldryn-search

Haystack 2.0 search index for django CMS
Other
48 stars 78 forks source link

TitleIndex not excluded, even if told so? #77

Closed benzkji closed 7 years ago

benzkji commented 7 years ago

I've extended aldryns TitleIndex and would like to use my own. However, haystack always complains like django.core.exceptions.ImproperlyConfigured: Model '<class 'cms.models.titlemodels.Title'>' has more than one 'SearchIndex`` handling it.

Trying to configre my HAYSTACK_CONNECTIONS with the following:

{
    'EXCLUDED_INDEXES': ['aldryn_search.search_indexes.TitleIndex', ]
}

But this only works for my own index, the above does not work? Any experiences on this behaviour?

benzkji commented 7 years ago

Haha, autodiscovery and own failure at it's best: Extending TitleIndex implies importing it into my search_indexes.py, so another TitleIndex is there, and discovered by haystack! . Also excluding my_app.search_indexes.TitleIndex in HAYSTACK_CONNECTIONS does the trick!