I have the following element in my XML:
<series id="iot" type="main">Institute of Theology</series>
What I am trying to do is to get all series values in the database along with the matching @id value in the most performance conscious way possible. I have set up an element range index on <series/> and also an attribute range index on @id. I've tried using cts:element-values() which works great to get the series element values, but I can't figure out how to return both the element and matching id values.
The end result I'm looking for should be like this:
iot Institute of Theology
You can get tuples of index values using cts:value-tuples.
For example, this will return pairs of series/@id and series:
cts:value-tuples((
cts:element-attribute-reference(xs:QName('series'), xs:QName('id')),
cts:element-reference(xs:QName('series'))
))
However, the pairs will only be accurate within <series> if there is only one <series> per document. Otherwise you will get all of the combinations of series/@id and series per document, regardless of whether they are from the same element.
If that is the case, then your options are to either change your documents (or use fragment roots, which is probably not a good idea), or use another method like Template Driven Extraction, where the pairs could be projected into a "stand-off" index, like rows, and then queried separate from the document context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With