Jump to content

search includes hidden pages


bbeer
 Share

Recommended Posts

Hi

the search outputs pages that are set to hidden in settings. the  search term is

$matches = $pages->find("title|body|summary%=$q, limit=50");

How can I exclude hidden pages from search listings Can I add other criteria to exclude pages?

thanks for your help

Link to comment
Share on other sites

Ok getting closer. those pages where children of a hidden document, but where set to visible. Is there a way to prevent such pages.

Another problem is, that unpublished pages are showing up in the search results as well. Can this be prevented?

Link to comment
Share on other sites

Ok getting closer. those pages where children of a hidden document, but where set to visible. Is there a way to prevent such pages.

Another problem is, that unpublished pages are showing up in the search results as well. Can this be prevented?

What do you mean by 'prevent'? You would want to enforce that children of a hidden page are also hidden?

Unpublished pages should be excluded by default; i'm not sure but you've got a funky thing going on.

Does explicitly adding status!=unpublished to your selector solve unpublished pages showing in the result?

Link to comment
Share on other sites

Solved! the unpublished Documents where listed when logged in only. 

Sorry for the confusion.

Need to add some more facts for your understanding.

In that site we use parent documents as folders for certain products (groups). We have several product groups. The client was sure, when he sets the parent Document to hidden, that all the child elements (products of that group) would be hidden as well. 

So it would really help, if it would be possible to hide all documents from search of a certain template, when the parent document is hidden, making it possible to hide whole product groups with one click.

your advise is much appreciated!

Link to comment
Share on other sites

  • 11 months later...

So it would really help, if it would be possible to hide all documents from search of a certain template, when the parent document is hidden, making it possible to hide whole product groups with one click.

your advise is much appreciated!

Hello,

my question is the same: how to hide page tree, or only parent is hidden and want to hide from search results and all it's children?

Tried with selector "parent != hidden", "has_parent != hidden" etc. but without success (not logged in).

Also option with id works but I need flexible options (for adminstrations / clients).

Thanks.

Link to comment
Share on other sites

Try this, but it can only work for direct descendants, not for a whole tree.

parent.status!=hidden

To get the whole tree excluded you'd need a more advanced selector, which only works on db calls and not for runtime filtering:

has_parent!=[status=hidden]

This does first call all hidden pages and then exclude them with the has_parent selector

  • Like 2
Link to comment
Share on other sites

has_parent!=[status=hidden]

Thank you LostKobrakai! That selector works.

My idea was to create field where they can store/type parents id like : "2025|2230"... and later in search template "has_parent!={...}".

Thanks and regards.

Link to comment
Share on other sites

  • 3 years later...
On 8/14/2015 at 8:56 AM, LostKobrakai said:

Try this, but it can only work for direct descendants, not for a whole tree.


parent.status!=hidden

To get the whole tree excluded you'd need a more advanced selector, which only works on db calls and not for runtime filtering:


has_parent!=[status=hidden]

This does first call all hidden pages and then exclude them with the has_parent selector

Try this. Closed admin pages

has_parent!=2

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...