Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indexing public and draft pages #26

Open
igloox opened this issue Jun 27, 2013 · 0 comments
Open

indexing public and draft pages #26

igloox opened this issue Jun 27, 2013 · 0 comments

Comments

@igloox
Copy link

igloox commented Jun 27, 2013

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant