You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's taken me all day to get to the bottom of this! I might be losing my mind here, but given the latest version of django-cms-search and django-cms 2.4.1 (and following the tutorials of both to get set up), haystack appears to index every page twice. That is, do a search for a common term on a typical site and in the results list of pages you'll see (for example) 'Home', 'Home', 'About Us', 'About Us', 'Contact Us', 'Contact Us', etc.
From what I can tell, haystack is indexing both the public and draft versions of the page objects. I'm new to django-cms but I get the impression the moderation system has changed recently. Anyway, there's a method in the cms PageManager class called 'public' which appears to return only the public (as opposed to draft) versions of the page. So in search_indexes.py
It's taken me all day to get to the bottom of this! I might be losing my mind here, but given the latest version of django-cms-search and django-cms 2.4.1 (and following the tutorials of both to get set up), haystack appears to index every page twice. That is, do a search for a common term on a typical site and in the results list of pages you'll see (for example) 'Home', 'Home', 'About Us', 'About Us', 'Contact Us', 'Contact Us', etc.
From what I can tell, haystack is indexing both the public and draft versions of the page objects. I'm new to django-cms but I get the impression the moderation system has changed recently. Anyway, there's a method in the cms PageManager class called 'public' which appears to return only the public (as opposed to draft) versions of the page. So in
search_indexes.py
If you change:
qs = base_qs.published(site=site_obj.id).filter(
to
qs = base_qs.public().published(site=site_obj.id).filter(
Only the public versions of the pages are indexed.
Peace out!
The text was updated successfully, but these errors were encountered: