We have a search:search() query that searches for <div> elements in a
database fragmented on <div> tags.

We want to sort the <div> tags based on an @order attribute so we passing
the sort-order option:

                    <sort-order type="xs:string" direction="ascending">
                        <element ns="" name="div"/>
                        <attribute ns="" name="order"/>
                    </sort-order>

But the results returned are not sorted on the order attribute.

When we turn on debugging with the <debug>true</debug> option I see in the
SEARCH-FLWOR the order by phrase:

      order by xs:string(($result//div/@order)[1]) ascending

What we actually want is:

      order by xs:string($result/@order) ascending

If I run the cts:query from the SEARCH-FLWOR with that modified order by
phrase it returns results sorted exactly as wanted.

Is there a way to coax search:search() to sort specifically on an attribute
of the result?

-- 
Keith
"Do what you can, with what you have, where you are." - Theodore Roosevelt
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to