Hi Greg, The Search API doesn't have support as yet for specifying "empty least" or "empty greatest" on sorting.
You can specify a *direction* as an attribute on the <sort-order> element (direction="ascending" or direction="descending"). When descending, the server defaults to empty least, and when ascending it defaults to empty greatest, so I think it *should* actually default to them coming out last. But collation is important here, and it's possible that the collation you're using here could be involved. If you have a very small set of test "name" elements you can share, along with how they're sorting, it might be helpful in understanding what you're seeing. --Colleen ________________________________________ From: [email protected] [[email protected]] On Behalf Of Murray, Gregory [[email protected]] Sent: Monday, February 20, 2012 10:37 AM To: MarkLogic Developer Discussion Subject: [MarkLogic Dev General] Search API results: sorting empty last When using the Search API and using a sort operator such as this: <search:operator name="sort"> <search:state name="name"> <search:sort-order type="xs:string" collation="http://marklogic.com/collation//AS/T0020"> <search:element ns="http://example.com/ns" name="name"/> </search:sort-order> </search:state> <!-- ... --> </search:operator> is there a way to specify that documents with a missing or empty <name> element should occur *last* in the sorted search results? It appears that empty values occur at the top of the search results by default. Thanks, Greg _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
