Thanks Gert, I meanwhile did the same test on a ML 8 instance and see that the index is also used for the more complex searchable expression.
Another good reason to upgrade ... Holger From: [email protected] [mailto:[email protected]] On Behalf Of Geert Josten Sent: 2015-10-20 15:16 To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] using index on sort with more complex searchable expression Hi Holger, I think you'll be interested in this section from the Performance guide: http://docs.marklogic.com/guide/performance/order_by Otherwise no immediate thoughts.. Cheers, Geert From: <[email protected]<mailto:[email protected]>> on behalf of Holger APEL <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Tuesday, October 20, 2015 at 3:08 PM To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: [MarkLogic Dev General] using index on sort with more complex searchable expression 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/"<http://marklogic.com/collation/%22>), 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/"<http://marklogic.com/collation/%22>), 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
