Perhaps we could introduce specific selectors that change a search to apply to ancestors.
For example, we currently have has:color to find anything that has a color (thanks guys!). Perhaps we could use parent:has:color to find nodes where the parent has a color, and ancestor:has:color to find nodes where any ancestor has a color.
So maybe prefixing any search with parent: or ancestor: would change the search to look up the tree.
So only search operators like has:color work after parent:?
What if you want to search for an item whose item contains two words: apple tree? If you write parent:apple tree it will be parsed as "look for items that contain “tree” and whose parent contains “apple”.
@Craig_Oliver: I see how your solution works, it’s somewhat tedious if you want to search for “a pretty long phrase I mean pretty long” in the parent, as you need to repeat the parent: part quite a few times.
The issue with quotations as proposed by @Francisco_Barros is that it’s hard to distinguish if you’re searching for exact substring or not. In normal syntax quotations represent requiring exact matches, but here it’s a little ambiguous what’s to be achieved by using the quotations.