3.1.5.6. Similarity

JCR allows you to search for nodes that are similar to an existing node.

Similarity is determined by looking up terms that are common to nodes. There are some conditions that must be met for a term to be considered. This is required to limit the number possibly relevant terms.

Note

The similarity functionality requires that the Highlighting support is enabled. Make sure that you have the following parameter set for the query handler in your workspace.xml file.


<param name="support-highlighting" value="true"/>

The functions are called rep:similar() (in XPath) and similar() (in SQL) and have two arguments:

Warning

Relative path is not supported yet.

Examples:

//element(*, nt:resource)[rep:similar(., '/parentnode/node.txt/jcr:content')]

Finds nt:resource nodes, which are similar to node by the /parentnode/node.txt/jcr:content path.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus