Jonathan Lahijani Posted July 23, 2021 Posted July 23, 2021 I want to find pages where the title has (word1|word2|word3) + word4. Meaning if word1/2/3 and word4 were in a page title, then it would match. I'm not sure if selectors can do this however? title~=word1|word2|word3 word4 That unfortunately does not work correctly. What am I missing?
Jonathan Lahijani Posted July 23, 2021 Author Posted July 23, 2021 I see this works but not as ideal: $results = $pages->find("title~=word1|word2|word3")->find("title~=word4");
horst Posted July 23, 2021 Posted July 23, 2021 According to the specs it should work like this (not tested) $results = $pages->find("title~=word1|word2|word3, title~=word4"); title=x, title=y is AND AND selectors: matching more than one value in the same field There will be instances where you need to say that a specific field matches more than one selector. This is simple, just specify all the conditions you need to match as separate selectors in the same string. For example: height>500, height<=1000 This AND selector matches all pages that have a "height" field greater than 500, and less than or equal to 1000. title=a|b|c, title=y should be the right combination https://processwire.com/docs/selectors/#and-selectors 4
Jonathan Lahijani Posted July 24, 2021 Author Posted July 24, 2021 I swear I tried that and it didn't work. But maybe I did something wrong and didn't notice. Anyway, it works now after looking at it with a fresh mind. 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now