FlowQuery: Why output from find() is different with «node-name» then with «identifier»?

Hi together,
I don’t understand, why the result is different if I’m search a node with «node-name» or «identifier»? In the Documentation I found no indication that something else could be expected. In real world there is a difference, I guess.

# with identifier 
title = ${q(node).find('#97a425db-285a-43dc-a4bc-dc100a85f280').property('title')}

output:

# with name
title = ${q(node).find('node-57653b3cc1866').property('title')}

output:

The backend Additional Info is:

the template:

<f:debug>{title}</f:debug>
  • Do I have some sign insert before (like the hash-sign for indentifier)?
    Strangely, I get without an .property('title') an object and not null.
    So the value for the «node-name» seems correct. But I can’t fiddle out, how I get the title.
title = ${q(node).find('node-57653b3cc1866')}

- Is there a difference in structure of returned value, when I use «node-name» or «identifier»?
- Is there somewhere an overview in a part of docu, what I get back? And how I can work with the different returned objects/values?
- And much more helpful: Is there some solution to format the <f:debug></f:debug> output/object from <f:debug> more eye-firendly?

Pretty sure you’re just not finding the node using the name.

It’s likely because the node is not a direct child of the node in the context you query from.

You’re debugging the FlowQuery object and not the actual content (the node in this case). Use ${q(node).find('node-57653b3cc1866').get()} to get the content.

FlowQuery is similar to how jQuery works as a wrapper.

See http://neos.readthedocs.io/en/stable/References/FlowQueryOperationReference.html#find

I’m quite sure, you are right :relaxed:, but also confused :astonished::

Why the find()is finding the node when I’m using the identifier: '#97a425db-285a-43dc-a4bc-dc100a85f280' and not finding the “same” node with using the name: 'node-57653b3cc1866'?

Of course you are right: I just finding not the node: test= ${q(node).find('node-57653b3cc1866').get()}
output:

Understanding-trial: Is .find(«Identifier») search “Neos-wide” and .find(«name») only in direct children, thats why «name» is not finding this «not direct-child» of the node in the context?

Sorry, I have to ask again, otherwise I’ll end up next time in the same dead end: Do I have to use .parent() /. siblings() and Co. in combination with .find(«name») and with .find(«identifier») I don’t have?


  • How can I find/use content from an other page (other node, not current query from ) in the actual page/node with flowQuery in ts2-file easiest?
  • Did someone knows a good and easy to understand tutorial/overview? I thought with the Hitchhikers (1, 2, 3, 4) I’ve got it. But this seams to be wrong…

If you use the path it has to be relative to where you’re finding it from. Identifiers are globally unique and paths aren’t.

It’s mentioned in http://neos.readthedocs.io/en/stable/References/FlowQueryOperationReference.html#find

Getting nodes by paths using .children('') only works on one level, whereas .find('') works for several levels.

Again it’s similar to how jQuery works, it might make sense to read up on jQuery for a better understanding.

You can use q(node).find('/relativePath/from/the/site/node') to find from other pages or combine like q(node).find('#identifier').find('collection/specificNode') or start from q(site) instead of q(node)

Now I think, I’ve got it. Thanks a lot Aske!


I only write it down for others, which also misunderstand the term «Name» in the backend/docu and search by google.

So, I misunderstood the term «Name». Thought it will be also an “unique-value” (like a sometimes readable, sometimes hashed) sibling from unique identifier.

Always thought: why two? Will certainly have a deeper reason: Maybe, only because «Name» is “sometimes” readable for humans :confused:.

Now I checked my surmise in the typo3_typo3cr_domain_model_nodedata and have found: The value from the term «Name» ist “only” the «last-path-part» from current node. But not unique: Also to find in children’s path.

«Name» means something like «endPartOfPathToCurrentNode» also in Docu.

.find(«node name») means .find(«partOfPath»)

If I use .find(«node name»), out of the docs, it would be the same like .find(«endPartOfPath»). «node name», «relative path» or «absolute path» is not quite different:
The big question for ‘absolute path’, ‘relative-path’ or (‘node name’ aka: 'endPartOfPath’ [kind of shortest relative-path from current node to children’s “endPartOfPath”]) is, where (on which node) I run the query and where my «path»-queryValue begins and ends.

  • I only get a usable return, when I search with find() an accessible/existing path.

.find(«identifier»)

This is quite different, because «identifier» is not a part of something, it is unique. Therefore no matter if absolute, relative or something else, or where I run the FlowQuery:

  • If the identifier exist, find() will hit the nail on the head and get always a usable return.
1 Like

Nope, the node name doesn’t have to be unique.
The (absolute) node path is unique (in one dimension), but it can change (i.e. when you move a node) thus it’s recommended to refer to the identifier