Element Word Query Throughs
Element-word-query-throughs allow you to specify elements that should be included in text searches that use cts:element-word-query
on a parent element. For example, consider this XML fragment:
<a> <b>hello</b> <c>goodbye</c> </a>
If you perform a cts:element-word-query
on <a>
searching for the word hello
, the search does not find any matches in this fragment. The following query shows this pattern:
cts:search(fn:doc(), cts:element-word-query(xs:QName("a"), "hello"))
This query does not find any matches because cts:element-word-query
only searches for text nodes that are immediate children of the element <a>
, not text nodes that are children of any child nodes of <a>
. Because hello
is in a text node that is a child of <b>
, it does not satisfy the cts:element-word-query
.
If you add an element-word-query-through for the element <b>
, however, then the cts:element-word-query
on <a>
searching for the word hello
returns a match. The element-word-query-through on <b>
causes the text node children of <b>
behave like the text node children of its parent (in this case, <a>
).
Note
If an element is specified as a phrase-through, then it also behaves as an element-word-query-through, and therefore you do not need to specify it as an element-word-query-through.