Hi Soumadri,

This solution is only work if you have mentioned element in your XML files.
Otherwise, you may change your database setting to enable
last modified date option. After that you have to change search:search
option to work on this property.

On Thu, May 12, 2016 at 4:34 PM, Indrajeet Verma <indrajeet.ve...@gmail.com>
wrote:

> 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 <
> srroychowdh...@innodata.com> 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
>> General@developer.marklogic.com
>> Manage your subscription at:
>> http://developer.marklogic.com/mailman/listinfo/general
>>
>>
>
> _______________________________________________
> General mailing list
> General@developer.marklogic.com
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>
_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to