Hi,
xdmp:plan() requires a partially searchable XPath expression or a cts:search()
expression. It doesn't accept xQuery like that. More information:
https://docs.marklogic.com/xdmp:plan
Here's an example that would work for you:
xdmp:plan(collection('test')/catalog/product/@dept)
Another alternative to check if your range index is being used do this:
let $_ := xdmp:query-trace(fn:true())
for $x in collection('test')/catalog/product
where $x/@dept = 'WMN'
return $x;
This will add detailed logging information to your MarkLogic logs which you can
use determine if your range index is being leveraged or not. The output in your
logs is mostly identical to what you see returned from xdmp:plan()
Best,
Rob
Rob Szkutak
Associate Consultant
MarkLogic Corporation
[email protected]
Cell +1.716.562.8464
www.marklogic.com<http://www.marklogic.com>
________________________________
From: [email protected]
[[email protected]] on behalf of 张晓博 [[email protected]]
Sent: Sunday, July 05, 2015 9:19 PM
To: [email protected]
Subject: [MarkLogic Dev General] How can i get the query plan for FWLOR query
statement?
The xquery is:
for $x in collection('test')/catalog/product
where $x/@dept = 'WMN'
return $x;
I had created attribute range index on product/@dept, I would like to know
whether the query will use the range index when marklogic process it.
so i ues the xdmp:plan to get the query plan, but i only the error :
<error:code>
XDMP-UNSEARCHABLE
</error:code>
<error:name>
</error:name>
<error:xquery-version>
1.0-ml
</error:xquery-version>
<error:message>
Expression is unsearchable
</error:message>
.......
so how can i get the query plan for FWLOR query statement?
or how can i konw whether the query will use the range index when marklogic
process it?
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general