I have xml files in the database with the root element of
“image”. What I want to do is to use search:search to query all the image
elements (no search term) and order them by the last-modified property. 

 

Below is what I have tried, but it doesn’t seem to actually be
sorting on the last-modified property (I do already have an element range index
on the property). It just returns hits based on relevance which is meaningless 
in this type of query.
Does anyone know how I can get this to work?

 

xquery
version '1.0-ml';

 

import
module namespace search = "http://marklogic.com/appservices/search";
at "/MarkLogic/appservices/search/search.xqy";

 

let
$options := 

     
<options xmlns="http://marklogic.com/appservices/search";>

           
<searchable-expression 
xmlns="http://marklogic.com/appservices/search";>/image</searchable-expression>

           
<search:sort-order type="xs:dateTime"
direction="descending">

     
           
<search:element ns="http://marklogic.com/xdmp/property";
name="last-modified"/>

     
      </search:sort-order>

     
</options>

 

return
search:search("", $options, 1, 16)

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

Reply via email to