Hi Brent, There are some tips about the order by optimization in the document performance.pdf, chapter 4.0 Optimizing Order By Expressions With Range Indexes, which is good to know.
Best Regards, John On Fri, Nov 4, 2011 at 10:06 PM, Brent Hartwig <[email protected]>wrote: > Good morning,**** > > ** ** > > I am trying to understand how to sort within cts:search(), before applying > the paging parameters. The code below only sorts the subset returned by > cts:search()[$start to $end]. Is this what collations are for? Do > collations require range indexes? Would search:search() make this easier? > **** > > ** ** > > The default sort will be against > $node/rdf:Description/dcterms:identifier/oxdc:doi/rdf:value; but, the > application is required to allow the users to sort by any column’s values > (other elements). Those sorts also need to apply to all results, rather > than only those on the current page.**** > > ** ** > > Thank you in advance.**** > > ** ** > > *return* > <list start="{$start}" end="{$end}" total="{xdmp:estimate(cts:search(/rdf:RDF, > $recordQuery, 'unfiltered'))}"> > { > (: TODO: Order all results by DOI then return $start to $end :) > *for* $node *in* *cts:search*(/rdf:RDF, $recordQuery, 'unfiltered')[$start > *to* $end] > *order by* $node/rdf:Description/dcterms:identifier/oxdc:doi/rdf:value > *return* > <item> > <doi>{$node/rdf:Description/dcterms:identifier/oxdc:doi/rdf:value/ > text()}</doi> > <title>{$node/rdf:Description/dcterms:title/text()}</title> > <products> > { > *for* $productCode *in* $node/rdf:Description/ > oxdc:resourceIdentifiers/oxdc:productCode/text() *return* > <product>{$productCode}</product> > } > </products> > </item> > } > </list>**** > > ** ** > > -Brent**** > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > >
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
