I'm using Django Haystack (with Aldryn Search) to search content on a client site. However, we need to modify the Articles indexed from the Aldryn NewsBlog plugin - Articles assigned to the Intranet Section should not be indexed. So I made a subclass in my plugin to override that like the documentation says to do:
Subclasses can override this method to avoid indexing certain objects.
However, when I try to rebuild the index it says:
aldryn_newsblog.models.Article has more than one 'SearchIndex`` handling it. Please exclude either aldryn_newsblog.search_indexes.ArticleIndex object or search_modifier.search_indexes.BlogHelperIndex object
The documentation is not clear to me what I need to write to have this modify the existing index from the NewsBlog plugin. I don't want to totally exclude it like the error is suggesting, but to subclass it like the documentation says to do.
Here is my search_indexes.py file:
from aldryn_newsblog.search_indexes import ArticleIndex
class BlogHelperIndex(ArticleIndex):
def index_queryset(self):
# make sure only public posts are pulled
return self.get_model().objects.exclude(app_config__app_title='DirectConnection')
I'm a moron. Aldryn Newsblog provides a simple checkbox in the Sections' settings to enable/disable indexing of that section without the need for a code change.