Cool - I'll check it out!

 

J Tim

 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Michael
Blakeley
Sent: Wednesday, March 27, 2013 6:07 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] How to program the order by clause in
FLWOR?

 

If you already have code to generate a cts:query and format results, you
might prefer search:resolve-nodes. That way you won't have to change as much
code, but it will still replace your FLWOR expression to handle sorting and
pagination. You'll just have to construct a search:options node for the
sorting, and provide the pagination and cts:query. The query has to be XML,
which you can generate using easily.

 

search:resolve-nodes(

  document { $query }/*, $options, $page-start, $page-size)

 

 <http://docs.marklogic.com/search:resolve-nodes>
http://docs.marklogic.com/search:resolve-nodes has more, and
<http://docs.marklogic.com/search:search>
http://docs.marklogic.com/search:search outlines the search options. Look
for '<sort-order>', like this example:

 

<sort-order type="xs:string" 

                collation=" <http://marklogic.com/collation/>
http://marklogic.com/collation/";

            direction="ascending">

  <element ns="my-namespace" name="my-element"/>

  <annotation>some user comment can go here</annotation> </sort-order>
<sort-order direction="ascending">

  <score/>

</sort-order>

 

-- Mike

 

On 27 Mar 2013, at 14:12 , "Tim" < <mailto:[email protected]> [email protected]>
wrote:

 

> Hi Mike,

> 

> True, plus I need to implement pagination.  It seems like the 

> search:search functionality is ideal, but I have a little bit of a
learning curve with it.

> I have looked at the documentation, but I'm wondering if there are any 

> examples available of transforming a cts:search into a search:search 

> function call?

> 

> Thanks again,

> 

> Tim

> 

> -----Original Message-----

> From:  <mailto:[email protected]>
[email protected]

> [ <mailto:[email protected]>
mailto:[email protected]] On Behalf Of Michael 

> Blakeley

> Sent: Wednesday, March 27, 2013 5:04 PM

> To: MarkLogic Developer Discussion

> Subject: Re: [MarkLogic Dev General] How to program the order by 

> clause in FLWOR?

> 

> What I mean is that if you want to support N sort keys, each ascending 

> or descending, you'll need to enumerate 2N conditionals. With string 

> concatenation and xdmp:value you can support any number, with much 

> less code. And then if you want to support multiple dynamic sort keys 

> at the same time, things get ugly fast.

> 

> -- Mike

> 

> 

> 

> _______________________________________________

> General mailing list

>  <mailto:[email protected]> [email protected]

>  <http://developer.marklogic.com/mailman/listinfo/general>
http://developer.marklogic.com/mailman/listinfo/general

> 

 

_______________________________________________

General mailing list

 <mailto:[email protected]> [email protected]

 <http://developer.marklogic.com/mailman/listinfo/general>
http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to