<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/cts.indexOrder.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>cts.indexOrder</api:function-name><api:suggest>cts.indexorder</api:suggest><api:suggest>cts</api:suggest><api:suggest>indexorder</api:suggest><api:function-link mode="xquery" fullname="cts:index-order">/apidoc/8.0/cts:index-order.xml</api:function-link><api:function mode="javascript" name="indexOrder" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:order Constructors" hidden="false" bucket="MarkLogic Built-In Functions" prefix="cts" namespace="http://marklogic.com/cts" fullname="cts.indexOrder"><api:summary>
  Creates a index-based ordering clause, for use as an option to
  cts:search.
</api:summary><api:params><api:param name="index" type="cts:reference"><api:param-description>
  A reference to a range index.
  </api:param-description><api:param-name>index</api:param-name><api:param-type>cts.reference</api:param-type></api:param><api:param name="options" type="xs:string*" optional="true"><api:param-description>
    Options.  The default is ().
    <p xmlns="http://www.w3.org/1999/xhtml">
      Options include:</p>
      <blockquote xmlns="http://www.w3.org/1999/xhtml"><dl>
        <dt>"descending"</dt>
        <dd>Results should be returned in descending order of index.</dd>
        <dt>"ascending"</dt>
        <dd>Results should be returned in ascending order of index.</dd>
     </dl></blockquote>
  </api:param-description><api:param-name>options</api:param-name><api:param-type>String[]</api:param-type></api:param></api:params><api:return>cts.order</api:return><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "ascending" or "descending" may be specified
  in the options parameter.  If neither "ascending" nor "descending"
  is specified, then the default is "ascending".</p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
cts.indexOrder(cts.elementReference(xs.QName("TITLE")));
=&gt;
cts.indexOrder(cts.elementReference(fn.QName("","TITLE"),
  ["type=string","collation=http://marklogic.com/collation/"]), "ascending")
</pre></api:example></api:function></api:function-page>