Jump to content

has_parent=/page/ not working within not()


suntrop
 Share

Recommended Posts

This excludes children of "/example/"  (/example/ has id of 1006)

$results = $pages->find("title|summary~=$q")->not("has_parent=1006");

… and this will exclude them too

$results = $pages->find("title|summary~=$q, has_parent!=/example/");

… but this won't 

$results = $pages->find("title|summary~=$q")->not("has_parent=/example/");

And … is there any difference using not() and != ?

Link to comment
Share on other sites

  • 1 month later...

has_parent isn't supported for runtime filtering with a path, not("selector") is filtering the results from the returned WireArray, there "has_parent" isn't supported in the same way as in a find selector. There's a path is converted to the ID before running the query.

Regarding performance and such your second example is the way to go.

  • Like 1
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

×
×
  • Create New...