Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xquery importing the cts ( couldn't use its functions)

I want to find distinct terms from a text using XQuery. This is my code:

declare namespace rec="http://xxx.xxx/xxx";
declare namespace cts="http://marklogic.com/cts";

for $r in /rec:Record 
return
distinctive-terms( $r/rec:text,<options xmlns="cts:distinctive-terms">  <max-terms>3</max-terms></options>)

I get the following error

1.0-ml] XDMP-UNDFUN: (err:XPST0017) Undefined function distinctive-terms()

I have changed declare namespace cts=" http://marklogic.com/cts to import module cts="http://marklogic.com/cts, but I need a location to import it from "... " I couldn't find the location of cts Anyone know what I should do??

like image 330
s.e Avatar asked Dec 14 '25 15:12

s.e


1 Answers

cts:distinctive-terms is a built-in function, so there is no need to import a module. The cts namespace is also built in and you shouldn't need to declare it. However, you still need to use the function prefix. Just declaring it doesn't change that.

So: cts:distinctive-terms($r/rec:text,...)

like image 94
mholstege Avatar answered Dec 18 '25 09:12

mholstege



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!