xquerydistinctmarklogicmarklogic-8

Xquery too much information returned from the function distinctive-terms


I'm trying to find the distinctive terms from a text using xquery in marlogic. When I use distinctive terms I got the following results

<cts:term id="146927407734894632" val="1142" score="292352"  confidence="0.990467" fitness="1">
  <cts:element-word-query>
    <cts:element xmlns:rec="http://xxx.xxx/xxx">rec:Text</cts:element>
    <cts:text xml:lang="en">ram</cts:text>
    <cts:option>case-insensitive</cts:option>
    <cts:option>diacritic-insensitive</cts:option>
    <cts:option>stemmed</cts:option>
    <cts:option>unwildcarded</cts:option>
  </cts:element-word-query>
</cts:term>

This is too much information for me. I'm only interested in <cts:text xml:lang="en">ram</cts:text>. Is there a way to just get the results of this line?


Solution

  • You can pull the cts:text out from the results with XPath:

    cts:distinctive-terms(...)//cts:text