Creating xpath for dynamic search of node by name

Hello dear bloomreach comunity colleagues, once again from my side. I have a node with a name. The node with this name can be placed in different subranches under hst:host. I want to detect and get all the nodes with this name. I know it is possible to search for nodes by primary type, by uuid, also other properties, but is there any way to look dynamically for nodes with a given name without having to know where exactly there are placed?

Hi,

you can search like:

//nodeName

But the node name itself must be an exact match. No wildcards or comparison operators are possible on node names.

You can also be more specific:

//content/documents//nodeName

the // means search all nodes underneath this path. I may have gone overboard with the // but this will work. Technically you could /content/documents//nodeName, but I’ve had some issues in the past that makes me overuse the syntax.

1 Like

Hi @jasper.floor, thank you very much for your answer. This is great and will help me. The “//” means a recursive search under a given path? Yes, I was trying it with wildcards, had no success and it is as simple as I see here. Thank you so much.

Yes, // means recursive search under a path. Glad to help, good luck!

1 Like