I have an XML document like this.
<Authors> <Author> <name>RN Tagore</name> <book>Gitanjli</book> </Author> <Author> <name>Premchand</name> <book>Panch Parameshvar</book> </Author> <Author> <name>HR Bacchan</name> <book>Madhushala</book> </Author> <Author> <name>Premchand</name> <book>Gaban</book> </Author> <Author> <name>Premchand</name> <book>Nirmala</book> </Author> <Author> <name>Premchand</name> <book>Nirmala</book> </Author> </Authors>
From the above XML, I need a separate list of author name.
For this I can write a query like
fn:distinct-values(cts:search(fn:doc()//pa:Author/pa:name,cts:and-query(())))
What the above code should do: it will get the result of the authors name, and then the fn: distinct-values () function will filter the individual author name from this result set. For the current scenario, it will work fine, because the data is only in XML 6, but when the data is very high, say 50 lac
cts:search(fn:doc()//pa:Author/pa:name,cts:and-query(()))
the above part of the request will throw an XDMP-EXPNTREECACHEFULL exception because we are trying to cache 50 lac elements in memory.
Therefore, you need your help to get only the individual author name using the cts: search or search: search API. I don't want to get the result set first, and then retrieve a single record from this result set with fn: distinct-values () .
Thanks,
source share