4

is it possible to make Lucene query in alfresco that finds nodes based on their parent/children properties? For example i want to find all the nodes that have the property "foo" set to '1' and have nodes associated to them by a child association with the property "baz" set to '2' (maybe specifing somehow the name of their child association)

something like

@crl\:numeroAtto:"6555" AND @crl\:firmatario:"Marco rossi"

Where "numeroAtto" is a property of the parent node and "firmatario" is a property of the child. The association type is "firmatari" (It's not in the query because i don't know how to use it)

To be even clearer i'm trying to tell lucene: "Find all nodes that have the property numeroAtto set to 6555 and that have children (association type with the children: firmatari) with the property "firmatario" set to Marco rossi.

Thanx in advance

Nicola Peluchetti
  • 76,206
  • 31
  • 145
  • 192

2 Answers2

5

You can't search on associations, so what we do is not to build slow queries. But add a new d:text property of the association on the parent Type.

So it's searchable through Lucune. To make it fully working, create a Java Behaviour which checks on content update. And when 'your' association is found it adds it to the d:text property.

This way lucene searches are very quick.

Tahir Malik
  • 6,623
  • 15
  • 22
4

There is no direct lucene way to do this.

Another idea: the first would return all of the parent nodes and then build searches based on the root of each returned node.

Dan H
  • 56
  • 1