Hi Soumadri,

Have you tried using OPTIONS? If not please see below and try to create it
based on your requirement and pass it into search:search(). I think this
should give you sorted results.

declare variable $SEARCH-OPTIONS :=
<options xmlns="http://marklogic.com/appservices/search";>
    <search-option>unfiltered</search-option>
    <page-length>10</page-length>
    <term>
        <term-option>case-insensitive</term-option>
        <term-option>punctuation-sensitive</term-option>
        <empty apply="all-results"/>
    </term>
    <grammar>

    </grammar>


    (: constraints for search  :)
    <constraint name="pub-type">

    </constraint>

    (: Sort of search result ------------------------------------------ :)
    <operator name="sort">
        <state name="relevance">
            <sort-order direction="descending">
                <score/>
            </sort-order>
            <sort-order direction="descending" type="xs:date">
                <element ns="" name="last modified date"/>
            </sort-order>
        </state>
        <state name="title">
            <sort-order direction="ascending" type="xs:string">
                <element ns="" name="Title"/>
            </sort-order>
            <sort-order>
                <score/>
            </sort-order>
        </state>

    </operator>
</options>;

Regards,
Indrajeet

On Thu, May 12, 2016 at 4:05 PM, Roy Chowdhury, Soumadri <
[email protected]> wrote:

> Hi,
>
>
>
> How can I search using search:search() which need to return documents
> order by the last modified date. As the number of documents are huge,
> bringing the whole result set and sorting using ‘order by’ FLOWR expression
> is not useful.
>
>
>
> Regards,
>
> Soumadri Roy
> "This e-mail and any attachments transmitted with it are for the sole use
> of the intended recipient(s) and may contain confidential , proprietary or
> privileged information. If you are not the intended recipient, please
> contact the sender by reply e-mail and destroy all copies of the original
> message. Any unauthorized review, use, disclosure, dissemination,
> forwarding, printing or copying of this e-mail or any action taken in
> reliance on this e-mail is strictly prohibited and may be unlawful."
>
> _______________________________________________
> General mailing list
> [email protected]
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to