Hi,

we are using ML 7.0-2.3 and I have a query where sorting creates 
XDMP-EXPNTREECACHEFULL. To tune the sorting we have already created a range 
index on the sorting element

let $t := xdmp:query-trace(true())
let $res := (for $result in cts:search(/(standard|standard-enquiry), 
cts:element-range-query(xs:QName("mle:xmltype"), "=", "std"))
order by $result//doc-number, $result//part-number
return $result)[1 to 10]
return $res

and the trace output shows no constraint is used for the sort

Analyzing path for search: fn:collection()/(standard|standard-enquiry)
Step 1 is searchable: fn:collection()
Step 2 is searchable: (standard|standard-enquiry)
Path is fully searchable.
Gathering constraints.
Step 2 contributed 1 constraint: standard
Step 2 contributed 1 constraint: standard-enquiry
Comparison contributed string range value constraint: mle:xmltype = "std"
Search query contributed 1 constraint: 
cts:element-range-query(xs:QName("mle:xmltype"), "=", "std", 
("collation=http://marklogic.com/collation/";), 1)
Executing search.
Selected 40694 fragments to filter.


but when I change the searchable expression to /standard I see that it uses the 
range index for sorting

Analyzing path for search: fn:collection()/standard
Step 1 is searchable: fn:collection()
Step 2 is searchable: standard
Path is fully searchable.
Gathering constraints.
Step 2 contributed 1 constraint: standard
Comparison contributed string range value constraint: mle:xmltype = "std"
Search query contributed 1 constraint: 
cts:element-range-query(xs:QName("mle:xmltype"), "=", "std", 
("collation=http://marklogic.com/collation/";), 1)
Order by clause contributed 1 range ordering constraint for $result: order by 
$result/descendant::doc-number ascending
Executing search.
Selected 40602 fragments to filter.


Is there a way to rephrase the searchable expression to make use of the index?
Will MarkLogic 8 handle this differently?

Thanks in advance for any input on that

Holger Apel
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to