Search for related references

I have a lot of example products, releated with many tags (references).

type: references
label: 'Tags'
reloadIfChanged: FALSE
group: related
nodeTypes: ['Vendor.Package:Tag']

'Neos.Neos:Document': TRUE

Problem, I would view on the product page, all products with same related tags.
How can I to this with Fusion, without writing a new ViewHelper?

Thanks for Helping

That depends on the exact number of “a lot” :slight_smile:

If you have 1000s of relations you will probably end up using ElasticSearch and configure how the tags property is indexed.

For fewer nodes using ${q(site).find('[instanceof Vendor.Package:Product]').filterByReference('tags', myTag).get()} might work.
The filterByReference Operation originates from wich you have to install first for that.

If you have lots of products i would not even try the second approach since the “find” operation is not really fast and all products will have to be checked every time. So in that case go directly to elasticSearch.

Thank you, for your answer.

I add the Flow.Listable package and the following code

body {
   tags = ${q(q(node).property('tags')).get()}
   prodByTagCollection = ${q(node).siblings('[instanceof Vendor.Package:Product]').filterByReference('tags', q(tags)).get()}

But my prodByTagCollection var in fluid template stays empty.
Do you have any idea, whas wrong?