<apidoc:module name="GeospatialBuiltins" category="SearchBuiltins" subcategory="Geospatial" lib="cts" xmlns:apidoc="http://marklogic.com/xdmp/apidoc"><apidoc:summary access="public" category="SearchBuiltins" subcategory="Geospatial">
The geospatial built-in functions are XQuery functions defined to operate on 
geospatial values.
</apidoc:summary><apidoc:function name="point" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a point value.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="latitude" type="xs:float" optional="false">
     The latitude of the point.
  </apidoc:param>
      <apidoc:param name="longitude" type="xs:float" optional="false">
     The longitude of the point.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:point</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  cts:point(0.373899653086420E+02, -0.122078578406509E+03)
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="point-latitude" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a point's latitude value.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="point" type="cts:point" optional="false">
     The point.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:float</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  let $point := cts:point(37.270556, -118.672778)
  return
  cts:point-latitude($point)
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="point-longitude" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a point's longitude value.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="point" type="cts:point" optional="false">
     The point.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:float</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  let $point := cts:point(37.270556, -118.672778)
  return
  cts:point-longitude($point)
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="box" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a geospatial box value.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="south" type="xs:float" optional="false">
    The southern boundary of the box.
  </apidoc:param>
      <apidoc:param name="west" type="xs:float" optional="false">
    The western boundary of the box.
  </apidoc:param>
      <apidoc:param name="north" type="xs:float" optional="false">
    The northern boundary of the box.
  </apidoc:param>
      <apidoc:param name="east" type="xs:float" optional="false">
    The eastern boundary of the box.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:box</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
cts:box(45, -122, 78, 30)
=&gt; [45, -122, 78, 30] (as a cts:box)
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="box-south" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a box's southern boundary.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="box" type="cts:box" optional="false">
     The box.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:float</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
cts:box-south(cts:box(45, -122, 78, 30))
=&gt; 45
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="box-west" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a box's western boundary.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="box" type="cts:box" optional="false">
     The box.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:float</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
cts:box-west(cts:box(45, -122, 78, 30))
=&gt; -122
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="box-north" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a box's northern boundary.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="box" type="cts:box" optional="false">
     The box.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:float</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
cts:box-north(cts:box(45, -122, 78, 30))
=&gt; 78
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="box-east" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a box's eastern boundary.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="box" type="cts:box" optional="false">
     The box.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:float</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
cts:box-east(cts:box(45, -122, 78, 30))
=&gt; 30
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="circle" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a geospatial circle value.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="radius" type="xs:float" optional="false">
    The radius of the circle.  The units for the radius is determined at 
    runtime by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code> options (miles is currently the only
    option).
  </apidoc:param>
      <apidoc:param name="center" type="cts:point" optional="false">
    A point representing the center of the circle.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:circle</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
cts:circle(20, cts:point(37.655983, -122.425525))
=&gt; @20 37.655983,-122.42552 (as a cts:circle)
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="circle-radius" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a circle's radius.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="circle" type="cts:circle" optional="false">
     The circle.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:float</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
cts:circle-radius(cts:circle(20, cts:point(37.655983, -122.425525)))
=&gt; 20
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="circle-center" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a circle's center point.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="circle" type="cts:circle" optional="false">
     The circle.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:point</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
cts:circle-center(cts:circle(20, cts:point(37.655983, -122.425525)))
=&gt; 37.655983, -122.425525 (as a cts:point)
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="polygon" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a geospatial polygon value.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="vertices" type="cts:point*" optional="false">
    The vertices of the polygon, given in order. No edge may cover
    more than 180 degrees of either latitude or longitude.  
    The polygon as a whole may not encompass both
    poles.  These constraints are necessary to ensure an unambiguous 
    interpretation of the polygon. There must be at least three vertices. 
    The first vertex should be identical to the last vertex to close the
    polygon.
    vertexes.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:polygon</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  (: this polygon approximates the 94041 zip code :)
  let $points := (cts:point(0.373899653086420E+02, -0.122078578406509E+03),
    cts:point(0.373765400000000E+02, -0.122063772000000E+03),
    cts:point(0.373781400000000E+02, -0.122067972000000E+03),
    cts:point(0.373825650000000E+02, -0.122068365000000E+03),
    cts:point(0.373797400000000E+02, -0.122072172000000E+03),
    cts:point(0.373899400000000E+02, -0.122092573000000E+03),
    cts:point(0.373941400000000E+02, -0.122095573000000E+03),
    cts:point(0.373966400000000E+02, -0.122094173000000E+03),
    cts:point(0.373958400000000E+02, -0.122092373000000E+03),
    cts:point(0.374004400000000E+02, -0.122091273000000E+03),
    cts:point(0.374004400000000E+02, -0.122091273000000E+03),
    cts:point(0.373873400000000E+02, -0.122057872000000E+03),
    cts:point(0.373873400000000E+02, -0.122057872000000E+03),
    cts:point(0.373854400000000E+02, -0.122052672000000E+03),
    cts:point(0.373833400000000E+02, -0.122053372000000E+03),
    cts:point(0.373819400000000E+02, -0.122057572000000E+03),
    cts:point(0.373775400000000E+02, -0.122060872000000E+03),
    cts:point(0.373765400000000E+02, -0.122063772000000E+03) )
  return
  cts:polygon($points)
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="polygon-vertices" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a polygon's vertices.  
  The first vertex and last vertex will always be the same.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="polygon" type="cts:polygon" optional="false">
     The polygon.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:point*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  let $node := 
    &lt;polygon zip="94041"&gt;
       0.373899653086420E+02,       -0.122078578406509E+03
       0.373765400000000E+02,       -0.122063772000000E+03
       0.373781400000000E+02,       -0.122067972000000E+03
       0.373825650000000E+02,       -0.122068365000000E+03
       0.373797400000000E+02,       -0.122072172000000E+03
       0.373899400000000E+02,       -0.122092573000000E+03
       0.373941400000000E+02,       -0.122095573000000E+03
       0.373966400000000E+02,       -0.122094173000000E+03
       0.373958400000000E+02,       -0.122092373000000E+03
       0.374004400000000E+02,       -0.122091273000000E+03
       0.374004400000000E+02,       -0.122091273000000E+03
       0.373873400000000E+02,       -0.122057872000000E+03
       0.373873400000000E+02,       -0.122057872000000E+03
       0.373854400000000E+02,       -0.122052672000000E+03
       0.373833400000000E+02,       -0.122053372000000E+03
       0.373819400000000E+02,       -0.122057572000000E+03
       0.373775400000000E+02,       -0.122060872000000E+03
       0.373765400000000E+02,       -0.122063772000000E+03
    &lt;/polygon&gt;
    return
    cts:polygon-vertices(cts:polygon(fn:data($node)))
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-geospatial-query" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code> matching elements by name whose content
  represents a point contained within the given geographic box, circle, or 
  polygon, or equal to the given point. Points that lie
  between the southern boundary and the northern boundary of a box,
  travelling northwards,
  and between the western boundary and the eastern boundary of the box,
  travelling eastwards, will match.  
  Points contained within the given radius of the center point of a circle will 
  match, using the curved distance on the surface of the Earth.
  Points contained within the given polygon will match, using great circle arcs 
  over a spherical model of the Earth as edges.  An error may result
  if the polygon is malformed in some way.
  Points equal to the a given point will match, taking into account the fact
  that longitudes converge at the poles.
  Using the geospatial query constructors requires a valid geospatial 
  license key; without a valid license key, searches that include 
  geospatial queries will throw an exception.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="element-name" type="xs:QName*" optional="false">
    One or more element QNames to match.  
    When multiple QNames are specified, 
    the query matches if any QName matches.
  </apidoc:param>
      <apidoc:param name="regions" type="cts:region*" optional="false">
    One or more geographic boxes, circles, polygons, or points. Where multiple
    regions are specified, the query matches if any region matches.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    Options to this query.  The default is ().
    <p xmlns="http://www.w3.org/1999/xhtml">Options include:</p>
      <blockquote xmlns="http://www.w3.org/1999/xhtml">
        <dl>
        <dt>"coordinate-system=wgs84"</dt>
        <dd>Use the WGS84 coordinate system.</dd>
        <dt>"units=miles"</dt>
        <dd>Distance (for circles) is measured in miles.</dd>
        <dt>"boundaries-included"</dt>
        <dd>Points on boxes', circles', and polygons' boundaries are counted as matching.  This is the default.</dd>
        <dt>"boundaries-excluded"</dt>
        <dd>Points on boxes', circles', and polygons' boundaries are not counted as matching.</dd>
        <dt>"boundaries-latitude-excluded"</dt>
        <dd>Points on boxes' latitude boundaries are not counted as matching.</dd>
        <dt>"boundaries-longitude-excluded"</dt>
        <dd>Points on boxes' longitude boundaries are not counted as matching.</dd>
        <dt>"boundaries-south-excluded"</dt>
        <dd>Points on the boxes' southern boundaries are not counted as matching.</dd>
        <dt>"boundaries-west-excluded"</dt>
        <dd>Points on the boxes' western boundaries are not counted as matching.</dd>
        <dt>"boundaries-north-excluded"</dt>
        <dd>Points on the boxes' northern boundaries are not counted as matching.</dd>
        <dt>"boundaries-east-excluded"</dt>
        <dd>Points on the boxes' eastern boundaries are not counted as matching.</dd>
        <dt>"boundaries-circle-excluded"</dt>
        <dd>Points on circles' boundary are not counted as matching.</dd>
        <dt>"cached"</dt>
        <dd>Cache the results of this query in the list cache.</dd>
        <dt>"uncached"</dt>
        <dd>Do not cache the results of this query in the list cache.</dd>
        <dt>"type=long-lat-point"</dt>
        <dd>Specifies the format for the point in the data as longitude first, 
	latitude second.</dd>
        <dt>"type=point"</dt>
        <dd>Specifies the format for the point in the data as latitude first, 
	longitude second.  This is the default format.</dd>
      </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="weight" type="xs:double?" optional="true">
    A weight for this query.  The default is 1.0. This option is currently 
    ignored; geospatial queries do not contribute to the score.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:element-geospatial-query</apidoc:return>
    <apidoc:usage>
<p xmlns="http://www.w3.org/1999/xhtml">The point value is expressed in the content of the element as a pair
of numbers, separated by whitespace and punctuation (excluding decimal points
and sign characters).
</p>
<p xmlns="http://www.w3.org/1999/xhtml">Point values and boundary specifications of 
boxes are given in degrees
relative to the WGS84 coordinate system.  Southern latitudes and Western 
longitudes take negative values.  Longitudes will be wrapped to the range 
(-180,+180) and latitudes will be clipped to the range (-90,+90).  
</p>
<p xmlns="http://www.w3.org/1999/xhtml">If the northern boundary of a box is south of the southern boundary, no 
points will match. However, longitudes wrap around the globe, so that if 
the western boundary is east of the eastern boundary,
then the box crosses the anti-meridian.
</p>
<p xmlns="http://www.w3.org/1999/xhtml">Special handling occurs at the poles, as all longitudes exist at latitudes 
+90 and -90.
</p>
<p xmlns="http://www.w3.org/1999/xhtml">If neither "cached" nor "uncached" is present, it specifies "cached".</p>
</apidoc:usage>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
(: create a document with test data :)
xdmp:document-insert("/points.xml",
&lt;root&gt;
  &lt;item&gt;&lt;point&gt;10.5, 30.0&lt;/point&gt;&lt;/item&gt;
  &lt;item&gt;&lt;point&gt;15.35, 35.34&lt;/point&gt;&lt;/item&gt;
  &lt;item&gt;&lt;point&gt;5.11, 40.55&lt;/point&gt;&lt;/item&gt;
&lt;/root&gt; );

cts:search(doc("/points.xml")//item, 
  cts:element-geospatial-query(xs:QName("point"), cts:box(10.0, 35.0, 20.0, 40.0)))
(:
  returns the following node: 
  &lt;item&gt;&lt;point&gt;15.35, 35.34&lt;/point&gt;&lt;/item&gt;
:)
;

cts:search(doc("/points.xml")//item, 
  cts:element-geospatial-query(xs:QName("point"), cts:box(10.0, 40.0, 20.0, 35.0)))
(:
  returns the following nodes (wrapping around the Earth):
  &lt;item&gt;&lt;point&gt;10.5, 30.0&lt;/point&gt;&lt;/item&gt;
:)
;

cts:search(doc("/points.xml")//item, 
  cts:element-geospatial-query(xs:QName("point"), cts:box(20.0, 35.0, 10.0, 40.0)))
(:
  throws an error (latitudes do not wrap)
:)
;
</pre>
</apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-geospatial-query-element-name" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the QNames used to construct the specified query.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:QName*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-geospatial-query(xs:QName("point"), cts:box(10.1, 10.2, 20.1, 20.2))
return
cts:element-geospatial-query-element-name($query)
  =&gt; xs:QName("point")
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-geospatial-query-region" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the geographical regions 
  with which the specified query was constructed.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:box*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-geospatial-query(xs:QName("point"),
       cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-geospatial-query-region($query)
  =&gt; cts:box(10.1, 10.2, 20.1, 20.2)
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-geospatial-query-options" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the options for the specified query.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:string*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-geospatial-query(xs:QName("point"), cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-geospatial-query-options($query)
  =&gt; "coordinate-system=wgs84"
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-geospatial-query-weight" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the weight with which the specified query was constructed.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:double</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-geospatial-query(xs:QName("point"), cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-geospatial-query-weight($query)
  =&gt; 1
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-child-geospatial-query" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code> matching elements by name which has 
  specific element children representing latitude and longitude values for
  a point contained within the given geographic box, circle, or polygon, or 
  equal to the given point.  Points that lie
  between the southern boundary and the northern boundary of a box, 
  travelling northwards,
  and between the western boundary and the eastern boundary of the box, 
  travelling eastwards, will match.  
  Points contained within the given radius of the center point of a circle will 
  match, using the curved distance on the surface of the Earth.
  Points contained within the given polygon will match, using great circle arcs 
  over a spherical model of the Earth as edges.  An error may result
  if the polygon is malformed in some way.
  Points equal to the a given point will match, taking into account the fact
  that longitudes converge at the poles.
  Using the geospatial query constructors requires a valid geospatial 
  license key; without a valid license key, searches that include 
  geospatial queries will throw an exception.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="parent-element-name" type="xs:QName*" optional="false">
    One or more parent element QNames to match.  
    When multiple QNames are specified, 
    the query matches if any QName matches.
  </apidoc:param>
      <apidoc:param name="child-element-names" type="xs:QName*" optional="false">
    One or more child element QNames to match.
    When multiple QNames are specified, the query matches
    if any QName matches; however, only the first matching latitude
    child in any point instance will be checked.  The element must specify 
    both latitude and longitude coordinates.
  </apidoc:param>
      <apidoc:param name="regions" type="cts:region*" optional="false">
    One or more geographic boxes, circles, polygons, or points. Where multiple 
    regions are specified, the query matches if any region matches.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    Options to this query.  The default is ().
    <p xmlns="http://www.w3.org/1999/xhtml">Options include:</p>
      <blockquote xmlns="http://www.w3.org/1999/xhtml">
        <dl>
        <dt>"coordinate-system=wgs84"</dt>
        <dd>Use the WGS84 coordinate system.</dd>
        <dt>"units=miles"</dt>
        <dd>Distance (for circles) is measured in miles.</dd>
        <dt>"boundaries-included"</dt>
        <dd>Points on boxes', circles', and polygons' boundaries are counted as matching.  This is the default.</dd>
        <dt>"boundaries-excluded"</dt>
        <dd>Points on boxes', circles', and polygons' boundaries are not counted as matching.</dd>
        <dt>"boundaries-latitude-excluded"</dt>
        <dd>Points on boxes' latitude boundaries are not counted as matching.</dd>
        <dt>"boundaries-longitude-excluded"</dt>
        <dd>Points on boxes' longitude boundaries are not counted as matching.</dd>
        <dt>"boundaries-south-excluded"</dt>
        <dd>Points on the boxes' southern boundaries are not counted as matching.</dd>
        <dt>"boundaries-west-excluded"</dt>
        <dd>Points on the boxes' western boundaries are not counted as matching.</dd>
        <dt>"boundaries-north-excluded"</dt>
        <dd>Points on the boxes' northern boundaries are not counted as matching.</dd>
        <dt>"boundaries-east-excluded"</dt>
        <dd>Points on the boxes' eastern boundaries are not counted as matching.</dd>
        <dt>"boundaries-circle-excluded"</dt>
        <dd>Points on circles' boundary are not counted as matching.</dd>
        <dt>"cached"</dt>
        <dd>Cache the results of this query in the list cache.</dd>
        <dt>"uncached"</dt>
        <dd>Do not cache the results of this query in the list cache.</dd>
        <dt>"type=long-lat-point"</dt>
        <dd>Specifies the format for the point in the data as longitude first, 
	latitude second.</dd>
        <dt>"type=point"</dt>
        <dd>Specifies the format for the point in the data as latitude first, 
	longitude second.  This is the default format.</dd>
      </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="weight" type="xs:double?" optional="true">
    A weight for this query.  The default is 1.0.
    This option is currently 
    ignored; geospatial queries do not contribute to the score.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:element-child-geospatial-query</apidoc:return>
    <apidoc:usage>
<p xmlns="http://www.w3.org/1999/xhtml">The point value is expressed in the content of the element as a child
of numbers, separated by whitespace and punctuation (excluding decimal points
and sign characters).
</p>
<p xmlns="http://www.w3.org/1999/xhtml">Point values and boundary specifications of boxes are given in degrees
relative to the WGS84 coordinate system.  Southern latitudes and Western 
longitudes take negative values.  Longitudes will be wrapped to the range 
(-180,+180) and latitudes will be clipped to the range (-90,+90).  
</p>
<p xmlns="http://www.w3.org/1999/xhtml">If the northern boundary of a box is south of the southern boundary, no 
points will  match. However, longitudes wrap around the globe, so that if 
the western boundary is east of the eastern boundary,
then the box crosses the anti-meridian.
</p>
<p xmlns="http://www.w3.org/1999/xhtml">Special handling occurs at the poles, as all longitudes exist at latitudes 
+90 and -90.
</p>
<p xmlns="http://www.w3.org/1999/xhtml">If neither "cached" nor "uncached" is present, it specifies "cached".</p>
</apidoc:usage>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
(: create a document with test data :)
xdmp:document-insert("/points.xml",
&lt;root&gt;
  &lt;item&gt;&lt;point&gt;&lt;pos&gt;10.5 30.0&lt;/pos&gt;&lt;/point&gt;&lt;/item&gt;
  &lt;item&gt;&lt;point&gt;&lt;pos&gt;15.35 35.34&lt;/pos&gt;&lt;/point&gt;&lt;/item&gt;
  &lt;item&gt;&lt;point&gt;&lt;pos&gt;5.11 40.55&lt;/pos&gt;&lt;/point&gt;&lt;/item&gt;
&lt;/root&gt; );

cts:search(doc("/points.xml")//item,
  cts:element-child-geospatial-query(xs:QName("point"), xs:QName("pos"),
    cts:box(10.0, 35.0, 20.0, 40.0)))
(:
  returns the following node: 
  &lt;item&gt;&lt;point&gt;&lt;pos&gt;15.35 35.34&lt;/pos&gt;&lt;/point&gt;&lt;/item&gt;
:)
;

cts:search(doc("/points.xml")//item, 
  cts:element-child-geospatial-query(xs:QName("point"), xs:QName("pos"),
    cts:box(10.0, 40.0, 20.0, 35.0)))
(:
  returns the following nodes (wrapping around the Earth):
  &lt;item&gt;&lt;point&gt;&lt;pos&gt;10.5 30.0&lt;/pos&gt;&lt;/point&gt;&lt;/item&gt;
:)
;

cts:search(doc("/points.xml")//item, 
  cts:element-child-geospatial-query(xs:QName("point"), xs:QName("pos"),
    cts:box(20.0, 35.0, 10.0, 40.0)))
(:
  throws an error (latitudes do not wrap)
:)
;
</pre>
</apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-child-geospatial-query-element-name" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the QNames used to construct the specified query.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-child-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:QName*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-child-geospatial-query(xs:QName("point"), xs:QName("pos"),
     cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-child-geospatial-query-element-name($query)
  =&gt; xs:QName("point")
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-child-geospatial-query-child-name" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the QNames used to construct the specified query.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-child-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:QName*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-child-geospatial-query(xs:QName("point"), xs:QName("pos"),
     cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-child-geospatial-query-child-name($query)
  =&gt; xs:QName("pos")
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-child-geospatial-query-region" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the geographical regions with which the specified query was constructed.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-child-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:region*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-child-geospatial-query(xs:QName("point"), xs:QName("pos"),
     cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-child-geospatial-query-region($query)
  =&gt; cts:box(10.1, 10.2, 20.1, 20.2)
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-child-geospatial-query-options" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the options for the specified query.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-child-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:string*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-child-geospatial-query(xs:QName("point"), xs:QName("pos"),
     cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-child-geospatial-query-options($query)
  =&gt; "coordinate-system=wgs84"
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-child-geospatial-query-weight" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the weight with which the specified query was constructed.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-child-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:double</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-child-geospatial-query(xs:QName("point"), xs:QName("pos"),
     cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-child-geospatial-query-weight($query)
  =&gt; 1
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-pair-geospatial-query" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code> matching elements by name which has 
  specific element children representing latitude and longitude values for
  a point contained within the given geographic box, circle, or polygon, or 
  equal to the given point. 
  Points that lie
  between the southern boundary and the northern boundary of a box, 
  travelling northwards,
  and between the western boundary and the eastern boundary of the box, 
  travelling eastwards, will match.  
  Points contained within the given radius of the center point of a circle will 
  match, using the curved distance on the surface of the Earth.
  Points contained within the given polygon will match, using great circle arcs 
  over a spherical model of the Earth as edges.  An error may result
  if the polygon is malformed in some way.
  Points equal to the a given point will match, taking into account the fact
  that longitudes converge at the poles.
  Using the geospatial query constructors requires a valid geospatial 
  license key; without a valid license key, searches that include 
  geospatial queries will throw an exception.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="element-name" type="xs:QName*" optional="false">
    One or more parent element QNames to match.  
    When multiple QNames are specified, 
    the query matches if any QName matches.
  </apidoc:param>
      <apidoc:param name="latitude-element-names" type="xs:QName*" optional="false">
    One or more latitude element QNames to match.
    When multiple QNames are specified, the query matches
    if any QName matches; however, only the first matching latitude
    child in any point instance will be checked.
  </apidoc:param>
      <apidoc:param name="longitude-element-names" type="xs:QName*" optional="false">
    One or more longitude element QNames to match.
    When multiple QNames are specified, the query matches
    if any QName matches; however, only the first matching longitude
    child in any point instance will be checked.
  </apidoc:param>
      <apidoc:param name="regions" type="cts:region*" optional="false">
    One or more geographic boxes, circles, polygons, or points. Where multiple
    regions are specified, the query matches if any region matches.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    Options to this query.  The default is ().
    <p xmlns="http://www.w3.org/1999/xhtml">Options include:</p>
      <blockquote xmlns="http://www.w3.org/1999/xhtml">
        <dl>
        <dt>"coordinate-system=wgs84"</dt>
        <dd>Use the WGS84 coordinate system.</dd>
        <dt>"units=miles"</dt>
        <dd>Distance (for circles) is measured in miles.</dd>
        <dt>"boundaries-included"</dt>
        <dd>Points on boxes', circles', and polygons' boundaries are counted as matching.  This is the default.</dd>
        <dt>"boundaries-excluded"</dt>
        <dd>Points on boxes', circles', and polygons' boundaries are not counted as matching.</dd>
        <dt>"boundaries-latitude-excluded"</dt>
        <dd>Points on boxes' latitude boundaries are not counted as matching.</dd>
        <dt>"boundaries-longitude-excluded"</dt>
        <dd>Points on boxes' longitude boundaries are not counted as matching.</dd>
        <dt>"boundaries-south-excluded"</dt>
        <dd>Points on the boxes' southern boundaries are not counted as matching.</dd>
        <dt>"boundaries-west-excluded"</dt>
        <dd>Points on the boxes' western boundaries are not counted as matching.</dd>
        <dt>"boundaries-north-excluded"</dt>
        <dd>Points on the boxes' northern boundaries are not counted as matching.</dd>
        <dt>"boundaries-east-excluded"</dt>
        <dd>Points on the boxes' eastern boundaries are not counted as matching.</dd>
        <dt>"boundaries-circle-excluded"</dt>
        <dd>Points on circles' boundary are not counted as matching.</dd>
        <dt>"cached"</dt>
        <dd>Cache the results of this query in the list cache.</dd>
        <dt>"uncached"</dt>
        <dd>Do not cache the results of this query in the list cache.</dd>
        <dt>"cached"</dt>
        <dd>Cache the results of this query in the list cache.</dd>
        <dt>"uncached"</dt>
        <dd>Do not cache the results of this query in the list cache.</dd>
      </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="weight" type="xs:double?" optional="true">
    A weight for this query.  The default is 1.0.
    This option is currently 
    ignored; geospatial queries do not contribute to the score.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:element-pair-geospatial-query</apidoc:return>
    <apidoc:usage>
<p xmlns="http://www.w3.org/1999/xhtml">The point value is expressed in the content of the element as a pair
of numbers, separated by whitespace and punctuation (excluding decimal points
and sign characters).
</p>
<p xmlns="http://www.w3.org/1999/xhtml">Point values and boundary specifications of boxes are given in degrees
relative to the WGS84 coordinate system.  Southern latitudes and Western 
longitudes take negative values.  Longitudes will be wrapped to the range 
(-180,+180) and latitudes will be clipped to the range (-90,+90).  
</p>
<p xmlns="http://www.w3.org/1999/xhtml">If the northern boundary of a box is south of the southern boundary, no 
points will  match. However, longitudes wrap around the globe, so that if 
the western boundary is east of the eastern boundary,
then the box crosses the anti-meridian.
</p>
<p xmlns="http://www.w3.org/1999/xhtml">Special handling occurs at the poles, as all longitudes exist at latitudes 
+90 and -90.
</p>
<p xmlns="http://www.w3.org/1999/xhtml">If neither "cached" nor "uncached" is present, it specifies "cached".</p>
</apidoc:usage>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
(: create a document with test data :)
xdmp:document-insert("/points.xml",
&lt;root&gt;
  &lt;item&gt;&lt;point&gt;&lt;lat&gt;10.5&lt;/lat&gt;&lt;long&gt;30.0&lt;/long&gt;&lt;/point&gt;&lt;/item&gt;
  &lt;item&gt;&lt;point&gt;&lt;lat&gt;15.35&lt;/lat&gt;&lt;long&gt;35.34&lt;/long&gt;&lt;/point&gt;&lt;/item&gt;
  &lt;item&gt;&lt;point&gt;&lt;lat&gt;5.11&lt;/lat&gt;&lt;long&gt;40.55&lt;/long&gt;&lt;/point&gt;&lt;/item&gt;
&lt;/root&gt; );

cts:search(doc("/points.xml")//item, 
  cts:element-pair-geospatial-query(xs:QName("point"), 
    xs:QName("lat"), xs:QName("long"), cts:box(10.0, 35.0, 20.0, 40.0)))
(:
  returns the following node: 
  &lt;item&gt;&lt;point&gt;&lt;lat&gt;15.35&lt;/lat&gt;&lt;long&gt;35.34&lt;/long&gt;&lt;/point&gt;&lt;/item&gt;
:)
;

cts:search(doc("/points.xml")//item, 
  cts:element-pair-geospatial-query(xs:QName("point"), 
    xs:QName("lat"), xs:QName("long"), cts:box(10.0, 40.0, 20.0, 35.0)))
(:
  returns the following nodes (wrapping around the Earth):
  &lt;item&gt;&lt;point&gt;&lt;lat&gt;10.5&lt;/lat&gt;&lt;long&gt;30.0&lt;/long&gt;&lt;/point&gt;&lt;/item&gt;
:)
;

cts:search(doc("/points.xml")//item, 
  cts:element-pair-geospatial-query(xs:QName("point"), 
    xs:QName("lat"), xs:QName("long"), cts:box(20.0, 35.0, 10.0, 40.0)))
(:
  throws an error (latitudes do not wrap)
:)
;
</pre>
</apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-pair-geospatial-query-element-name" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the QNames used to construct the specified query.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-pair-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:QName*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-pair-geospatial-query(xs:QName("point"), 
     xs:QName("lat"), xs:QName("long"), cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-pair-geospatial-query-element-name($query)
  =&gt; xs:QName("point")
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-pair-geospatial-query-latitude-name" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the QNames used to construct the specified query.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-pair-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:QName*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-pair-geospatial-query(xs:QName("point"), 
     xs:QName("lat"), xs:QName("long"), cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-pair-geospatial-query-latitude-name($query)
  =&gt; xs:QName("lat")
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-pair-geospatial-query-longitude-name" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the QNames used to construct the specified query.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-pair-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:QName*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-pair-geospatial-query(xs:QName("point"), 
     xs:QName("lat"), xs:QName("long"), cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-pair-geospatial-query-longitude-name($query)
  =&gt; xs:QName("lat")
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-pair-geospatial-query-region" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the geographical regions with which the specified query was constructed.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-pair-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:region*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-pair-geospatial-query(xs:QName("point"), 
     xs:QName("lat"), xs:QName("long"), cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-pair-geospatial-query-region($query)
  =&gt; cts:box(10.1, 10.2, 20.1, 20.2)
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-pair-geospatial-query-options" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the options for the specified query.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-pair-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:string*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-pair-geospatial-query(xs:QName("point"), 
     xs:QName("lat"), xs:QName("long"), cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-pair-geospatial-query-options($query)
  =&gt; "coordinate-system=wgs84"
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-pair-geospatial-query-weight" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the weight with which the specified query was constructed.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-pair-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:double</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-pair-geospatial-query(xs:QName("point"), 
     xs:QName("lat"), xs:QName("long"), cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-pair-geospatial-query-weight($query)
  =&gt; 1
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-attribute-pair-geospatial-query" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns a <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code> matching elements by name which has 
  specific attributes representing latitude and longitude values for
  a point contained within the given geographic box, circle, or polygon, 
  or equal to the given point. Points that lie
  between the southern boundary and the northern boundary of a box, 
  travelling northwards,
  and between the western boundary and the eastern boundary of the box, 
  travelling eastwards, will match.  
  Points contained within the given radius of the center point of a circle will 
  match, using the curved distance on the surface of the Earth.
  Points contained within the given polygon will match, using great circle arcs 
  over a spherical model of the Earth as edges.  An error may result
  if the polygon is malformed in some way.
  Points equal to the a given point will match, taking into account the fact
  that longitudes converge at the poles.
  Using the geospatial query constructors requires a valid geospatial 
  license key; without a valid license key, searches that include 
  geospatial queries will throw an exception.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="element-name" type="xs:QName*" optional="false">
    One or more parent element QNames to match.  
    When multiple QNames are specified, 
    the query matches if any QName matches.
  </apidoc:param>
      <apidoc:param name="latitude-attribute-names" type="xs:QName*" optional="false">
    One or more latitude attribute QNames to match.
    When multiple QNames are specified, the query matches
    if any QName matches; however, only the first matching latitude
    attribute in any point instance will be checked.
  </apidoc:param>
      <apidoc:param name="longitude-attribute-names" type="xs:QName*" optional="false">
    One or more longitude attribute QNames to match.
    When multiple QNames are specified, the query matches
    if any QName matches; however, only the first matching longitude
    attribute in any point instance will be checked.
  </apidoc:param>
      <apidoc:param name="regions" type="cts:region*" optional="false">
    One or more geographic boxes, circles, polygons, or points. Where 
    multiple regions 
    are specified, the query matches if any region matches.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    Options to this query.  The default is ().
    <p xmlns="http://www.w3.org/1999/xhtml">Options include:</p>
      <blockquote xmlns="http://www.w3.org/1999/xhtml">
        <dl>
        <dt>"coordinate-system=wgs84"</dt>
        <dd>Use the WGS84 coordinate system.</dd>
        <dt>"units=miles"</dt>
        <dd>Distance (for circles) is measured in miles.</dd>
        <dt>"boundaries-included"</dt>
        <dd>Points on boxes', circles', and polygons' boundaries are counted as matching.  This is the default.</dd>
        <dt>"boundaries-excluded"</dt>
        <dd>Points on boxes', circles', and polygons' boundaries are not counted as matching.</dd>
        <dt>"boundaries-latitude-excluded"</dt>
        <dd>Points on boxes' latitude boundaries are not counted as matching.</dd>
        <dt>"boundaries-longitude-excluded"</dt>
        <dd>Points on boxes' longitude boundaries are not counted as matching.</dd>
        <dt>"boundaries-south-excluded"</dt>
        <dd>Points on the boxes' southern boundaries are not counted as matching.</dd>
        <dt>"boundaries-west-excluded"</dt>
        <dd>Points on the boxes' western boundaries are not counted as matching.</dd>
        <dt>"boundaries-north-excluded"</dt>
        <dd>Points on the boxes' northern boundaries are not counted as matching.</dd>
        <dt>"boundaries-east-excluded"</dt>
        <dd>Points on the boxes' eastern boundaries are not counted as matching.</dd>
        <dt>"boundaries-circle-excluded"</dt>
        <dd>Points on circles' boundary are not counted as matching.</dd>
        <dt>"cached"</dt>
        <dd>Cache the results of this query in the list cache.</dd>
        <dt>"uncached"</dt>
        <dd>Do not cache the results of this query in the list cache.</dd>
      </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="weight" type="xs:double?" optional="true">
    A weight for this query.  The default is 1.0.
    This option is currently 
    ignored; geospatial queries do not contribute to the score.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:element-attribute-pair-geospatial-query</apidoc:return>
    <apidoc:usage>
<p xmlns="http://www.w3.org/1999/xhtml">The point value is expressed as the numerical values in the 
textual content of the named attributes.
</p>
<p xmlns="http://www.w3.org/1999/xhtml">The point values and the boundary specifications are given in degrees 
relative to the WGS84 coordinate system.  Southern latitudes and Western 
longitudes take negative values.  Longitudes will be wrapped to the range 
(-180,+180) and latitudes will be clipped to the range (-90,+90).  
</p>
<p xmlns="http://www.w3.org/1999/xhtml">If the northern boundary of a box is south of the southern boundary, 
no points will  
match. However, longitudes wrap around the globe, so that if the western 
boundary is east of the eastern boundary (that is, if the value of 'w' is 
greater than the value of 'e'), then the box crosses the anti-meridian.
</p>
<p xmlns="http://www.w3.org/1999/xhtml">Special handling occurs at the poles, as all longitudes exist at latitudes 
+90 and -90.
</p>
<p xmlns="http://www.w3.org/1999/xhtml">If neither "cached" nor "uncached" is present, it specifies "cached".</p>
</apidoc:usage>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
(: create a document with test data :)
xdmp:document-insert("/points.xml",
&lt;root&gt;
  &lt;item&gt;&lt;point lat="10.5" long="30.0"/&gt;&lt;/item&gt;
  &lt;item&gt;&lt;point lat="15.35" long="35.34"/&gt;&lt;/item&gt;
  &lt;item&gt;&lt;point lat="5.11" long="40.55"/&gt;&lt;/item&gt;
&lt;/root&gt; );

cts:search(doc("/points.xml")//item, 
  cts:element-attribute-pair-geospatial-query(xs:QName("point"), 
    xs:QName("lat"), xs:QName("long"), cts:box(10.0, 35.0, 20.0, 40.0)))
(:
  returns the following node: 
  &lt;item&gt;&lt;point lat="15.35" long="35.34"/&gt;&lt;/item&gt;
:)
;

cts:search(doc("/points.xml")//item, 
  cts:element-attribute-pair-geospatial-query(xs:QName("point"), 
    xs:QName("lat"), xs:QName("long"), cts:box(10.0, 40.0, 20.0, 35.0)))
(:
  returns the following nodes (wrapping around the Earth):
  &lt;item&gt;&lt;point lat="10.5" long="30.0"/&gt;&lt;/item&gt;
:)
;

cts:search(doc("/points.xml")//item, 
  cts:element-attribute-pair-geospatial-query(xs:QName("point"), 
    xs:QName("lat"), xs:QName("long"), cts:box(20.0, 35.0, 10.0, 40.0)))
(:
  throws an error (latitudes do not wrap)
:)
;
</pre>
</apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-attribute-pair-geospatial-query-element-name" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the QNames used to construct the specified query.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-attribute-pair-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:QName*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-attribute-pair-geospatial-query(xs:QName("point"), 
     xs:QName("lat"), xs:QName("long"), cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-attribute-pair-geospatial-query-element-name($query)
  =&gt; xs:QName("point")
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-attribute-pair-geospatial-query-latitude-name" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the QNames used to construct the specified query.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-attribute-pair-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:QName*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-attribute-pair-geospatial-query(xs:QName("point"), 
     xs:QName("lat"), xs:QName("long"), cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-attribute-pair-geospatial-query-latitude-name($query)
  =&gt; xs:QName("lat")
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-attribute-pair-geospatial-query-longitude-name" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the QNames used to construct the specified query.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-attribute-pair-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:QName*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-attribute-pair-geospatial-query(xs:QName("point"), 
     xs:QName("lat"), xs:QName("long"), cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-attribute-pair-geospatial-query-longitude-name($query)
  =&gt; xs:QName("lat")
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-attribute-pair-geospatial-query-region" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the geographical regions with which the specified query was constructed.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-attribute-pair-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:region*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-attribute-pair-geospatial-query(xs:QName("point"), 
     xs:QName("lat"), xs:QName("long"), cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-attribute-pair-geospatial-query-region($query)
  =&gt; cts:box(10.1, 10.2, 20.1, 20.2)
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-attribute-pair-geospatial-query-options" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the options for the specified query.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-attribute-pair-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:string*</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-attribute-pair-geospatial-query(xs:QName("point"), 
     xs:QName("lat"), xs:QName("long"), cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-attribute-pair-geospatial-query-options($query)
  =&gt; "coordinate-system=wgs84"
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-attribute-pair-geospatial-query-weight" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the weight with which the specified query was constructed.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="query" type="cts:element-attribute-pair-geospatial-query" optional="false">
    A query.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:double</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $query := 
   cts:element-attribute-pair-geospatial-query(xs:QName("point"), 
     xs:QName("lat"), xs:QName("long"), cts:box(10.1, 10.2, 20.1, 20.2))
return cts:element-attribute-pair-geospatial-query-weight($query)
  =&gt; 1
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="element-geospatial-boxes" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  <p xmlns="http://www.w3.org/1999/xhtml">Returns boxes derived from the specified element point lexicon(s).  
  Element point lexicons are implemented using geospatial indexes; consequently 
  this function requires an element geospatial index for each element
  specified in the function.  If there is not a geospatial index configured for 
  each of the specified elements, an exception is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">The points are divided into box-shaped buckets. The $latitude-bounds and 
  $longitude-bounds parameters specify the number and the size of each 
  box-shaped bucket. All included points are bucketed, even those outside 
  the bounds.  An empty sequence for both $latitude-bounds and 
  $longitude-bounds specifies one bucket, a single value for both specifies
  four buckets, two values for both specify nine buckets, and so on.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">For each non-empty bucket, a <code>cts:box</code> value is returned.
  By default, the <code>cts:box</code> value is the minimum bounding box 
  of all the points in the bucket.  If the "gridded" option is specified, 
  then if a bucket is bounded on a side, its corresponding 
  <code>cts:box</code> side is the bound.   
  Empty buckets return nothing unless the "empties" option is specified.</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="element-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="latitude-bounds" type="xs:double*" optional="true">
    A sequence of latitude bounds. 
    The values must be in strictly ascending order, otherwise an exception
    is thrown.
  </apidoc:param>
      <apidoc:param name="longitude-bounds" type="xs:double*" optional="true">
    A sequence of longitude bounds. 
    The values must be in strictly ascending order, otherwise an exception
    is thrown.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"ascending"</dt>
        <dd>Boxes should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Boxes should be returned in descending order.</dd>
        <dt>"gridded"</dt>
        <dd>For each side that a bucket is bounded, return the corresponding
        bound as the edge of the box, instead of the extremum from the 
        points in the bucket.</dd>
        <dt>"empties"</dt>
        <dd>Include fully-bounded ranges whose frequency is 0.  Only 
        empty ranges that have 
        both their upper and lower bounds specified in the $bounds 
        options are returned;
        any empty ranges that are less than the first bound or greater than the 
        last bound are not returned.  For example, if you specify 4 bounds
        and there are no results for any of the bounds, 3 elements are 
        returned (not 5 elements).</dd>
        <dt>"any"</dt>
        <dd>Points from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Points from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Points from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Points from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Boxes should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Boxes should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included point.  
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included point. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>Use the lexicon with the coordinate system specified by 
        <em>name</em>.</dd>
        <dt>"limit=<em>N</em>"</dt>
        <dd>Return no more than <em>N</em> boxes.</dd>
        <dt>"sample=<em>N</em>"</dt>
        <dd>Return only boxes for buckets with at least one point from the
        first <em>N</em> fragments selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only points from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"type=long-lat-point"</dt>
        <dd>Specifies the format for the point in the data as longitude first, 
	latitude second.</dd>
        <dt>"type=point"</dt>
        <dd>Specifies the format for the point in the data as latitude first, 
	longitude second.  This is the default format.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include points in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included points.
    The points do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as 
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations.    
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:box*</apidoc:return>
    <apidoc:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all boxes with included points may be returned. If a <code>$query</code>
  parameter is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then points from all fragments selected by the <code>$query</code> parameter 
  are included.  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
</apidoc:usage>
  </apidoc:function><apidoc:function name="element-child-geospatial-boxes" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  <p xmlns="http://www.w3.org/1999/xhtml">Returns boxes derived from the specified element point lexicon(s).  
  Element point lexicons are implemented using geospatial indexes; consequently 
  this function requires an element child geospatial index for each element
  specified in the function.  If there is not a geospatial index configured for 
  each of the specified element/child combinations, an exception is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">The points are divided into box-shaped buckets. The $latitude-bounds and 
  $longitude-bounds parameters specify the number and the size of each 
  box-shaped bucket. All included points are bucketed, even those outside 
  the bounds.  An empty sequence for both $latitude-bounds and 
  $longitude-bounds specifies one bucket, a single value for both specifies
  four buckets, two values for both specify nine buckets, and so on.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">For each non-empty bucket, a <code>cts:box</code> value is returned.
  By default, the <code>cts:box</code> value is the minimum bounding box 
  of all the points in the bucket.  If the "gridded" option is specified, 
  then if a bucket is bounded on a side, its corresponding 
  <code>cts:box</code> side is the bound.   
  Empty buckets return nothing unless the "empties" option is specified.</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="parent-element-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="child-element-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="latitude-bounds" type="xs:double*" optional="true">
    A sequence of latitude bounds. 
    The values must be in strictly ascending order, otherwise an exception
    is thrown.
  </apidoc:param>
      <apidoc:param name="longitude-bounds" type="xs:double*" optional="true">
    A sequence of longitude bounds. 
    The values must be in strictly ascending order, otherwise an exception
    is thrown.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"ascending"</dt>
        <dd>Boxes should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Boxes should be returned in descending order.</dd>
        <dt>"gridded"</dt>
        <dd>For each side that a bucket is bounded, return the corresponding
        bound as the edge of the box, instead of the extremum from the 
        points in the bucket.</dd>
        <dt>"empties"</dt>
        <dd>Include fully-bounded ranges whose frequency is 0.   Only 
        empty ranges that have 
        both their upper and lower bounds specified in the $bounds 
        options are returned;
        any empty ranges that are less than the first bound or greater than the 
        last bound are not returned.  For example, if you specify 4 bounds
        and there are no results for any of the bounds, 3 elements are 
        returned (not 5 elements).</dd>
        <dt>"any"</dt>
        <dd>Points from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Points from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Points from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Points from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Boxes should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Boxes should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included point.  
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included point. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>Use the lexicon with the coordinate system specified by 
        <em>name</em>.</dd>
        <dt>"limit=<em>N</em>"</dt>
        <dd>Return no more than <em>N</em> boxes.</dd>
        <dt>"sample=<em>N</em>"</dt>
        <dd>Return only boxes for buckets with at least one point from the
        first <em>N</em> fragments selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only points from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"type=long-lat-point"</dt>
        <dd>Specifies the format for the point in the data as longitude first, 
	latitude second.</dd>
        <dt>"type=point"</dt>
        <dd>Specifies the format for the point in the data as latitude first, 
	longitude second.  This is the default format.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include points in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included points.
    The points do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as  
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations.    
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:box*</apidoc:return>
    <apidoc:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all boxes with included points may be returned. If a <code>$query</code>
  parameter is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then points from all fragments selected by the <code>$query</code> parameter 
  are included.  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
</apidoc:usage>
  </apidoc:function><apidoc:function name="element-pair-geospatial-boxes" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  <p xmlns="http://www.w3.org/1999/xhtml">Returns boxes derived from the specified element point lexicon(s).  
  Element point lexicons are implemented using geospatial indexes; consequently 
  this function requires a geospatial element pair index for each
  parent and pair of child elements
  specified in the function.  If there is not a geospatial index configured for 
  each of the specified combinations, an exception is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">The points are divided into box-shaped buckets. The $latitude-bounds and 
  $longitude-bounds parameters specify the number and the size of each 
  box-shaped bucket. All included points are bucketed, even those outside 
  the bounds.  An empty sequence for both $latitude-bounds and 
  $longitude-bounds specifies one bucket, a single value for both specifies
  four buckets, two values for both specify nine buckets, and so on.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">For each non-empty bucket, a <code>cts:box</code> value is returned.
  By default, the <code>cts:box</code> value is the minimum bounding box 
  of all the points in the bucket.  If the "gridded" option is specified, 
  then if a bucket is bounded on a side, its corresponding 
  <code>cts:box</code> side is the bound.   
  Empty buckets return nothing unless the "empties" option is specified.</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="parent-element-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="latitude-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="longitude-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="latitude-bounds" type="xs:double*" optional="true">
    A sequence of latitude bounds. 
    The values must be in strictly ascending order, otherwise an exception
    is thrown.
  </apidoc:param>
      <apidoc:param name="longitude-bounds" type="xs:double*" optional="true">
    A sequence of longitude bounds. 
    The values must be in strictly ascending order, otherwise an exception
    is thrown.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"ascending"</dt>
        <dd>Boxes should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Boxes should be returned in descending order.</dd>
        <dt>"gridded"</dt>
        <dd>For each side that a bucket is bounded, return the corresponding
        bound as the edge of the box, instead of the extremum from the 
        points in the bucket.</dd>
        <dt>"empties"</dt>
        <dd>Include fully-bounded ranges whose frequency is 0. Only 
        empty ranges that have 
        both their upper and lower bounds specified in the $bounds 
        options are returned;
        any empty ranges that are less than the first bound or greater than the 
        last bound are not returned.  For example, if you specify 4 bounds
        and there are no results for any of the bounds, 3 elements are 
        returned (not 5 elements).</dd>
        <dt>"any"</dt>
        <dd>Points from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Points from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Points from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Points from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Boxes should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Boxes should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included point.  
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included point. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>Use the lexicon with the coordinate system specified by 
        <em>name</em>.</dd>
        <dt>"limit=<em>N</em>"</dt>
        <dd>Return no more than <em>N</em> boxes.</dd>
        <dt>"sample=<em>N</em>"</dt>
        <dd>Return only boxes for buckets with at least one point from the
        first <em>N</em> fragments selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only points from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include points in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included points.
    The points do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as  
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations.    
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:box*</apidoc:return>
    <apidoc:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all boxes with included points may be returned. If a <code>$query</code>
  parameter is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then points from all fragments selected by the <code>$query</code> parameter 
  are included.  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
</apidoc:usage>
  </apidoc:function><apidoc:function name="element-attribute-pair-geospatial-boxes" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  <p xmlns="http://www.w3.org/1999/xhtml">Returns boxes derived from the specified element point lexicon(s).  
  Element point lexicons are implemented using geospatial indexes; consequently 
  this function requires a geospatial element attribute pair index for each
  prarent element and attribute pair
  specified in the function.  If there is not a geospatial index configured for 
  each of the specified combinations, an exception is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">The points are divided into box-shaped buckets. The $latitude-bounds and 
  $longitude-bounds parameters specify the number and the size of each 
  box-shaped bucket. All included points are bucketed, even those outside 
  the bounds.  An empty sequence for both $latitude-bounds and 
  $longitude-bounds specifies one bucket, a single value for both specifies
  four buckets, two values for both specify nine buckets, and so on.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">For each non-empty bucket, a <code>cts:box</code> value is returned.
  By default, the <code>cts:box</code> value is the minimum bounding box 
  of all the points in the bucket.  If the "gridded" option is specified, 
  then if a bucket is bounded on a side, its corresponding 
  <code>cts:box</code> side is the bound.   
  Empty buckets return nothing unless the "empties" option is specified.</p>
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="parent-element-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="latitude-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="longitude-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="latitude-bounds" type="xs:double*" optional="true">
    A sequence of latitude bounds. 
    The values must be in strictly ascending order, otherwise an exception
    is thrown.
  </apidoc:param>
      <apidoc:param name="longitude-bounds" type="xs:double*" optional="true">
    A sequence of longitude bounds. 
    The values must be in strictly ascending order, otherwise an exception
    is thrown.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"ascending"</dt>
        <dd>Boxes should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Boxes should be returned in descending order.</dd>
        <dt>"gridded"</dt>
        <dd>For each side that a bucket is bounded, return the corresponding
        bound as the edge of the box, instead of the extremum from the 
        points in the bucket.</dd>
        <dt>"empties"</dt>
        <dd>Include fully-bounded ranges whose frequency is 0.  Only 
        empty ranges that have 
        both their upper and lower bounds specified in the $bounds 
        options are returned;
        any empty ranges that are less than the first bound or greater than the 
        last bound are not returned.  For example, if you specify 4 bounds
        and there are no results for any of the bounds, 3 elements are 
        returned (not 5 elements).</dd>
        <dt>"any"</dt>
        <dd>Points from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Points from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Points from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Points from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Boxes should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Boxes should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included point.  
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included point. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>Use the lexicon with the coordinate system specified by 
        <em>name</em>.</dd>
        <dt>"limit=<em>N</em>"</dt>
        <dd>Return no more than <em>N</em> boxes.</dd>
        <dt>"sample=<em>N</em>"</dt>
        <dd>Return only boxes for buckets with at least one point from the
        first <em>N</em> fragments selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only points from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include points in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included points.
    The points do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as  
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations.    
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:box*</apidoc:return>
    <apidoc:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all boxes with included points may be returned. If a <code>$query</code>
  parameter is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then points from all fragments selected by the <code>$query</code> parameter 
  are included.  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
</apidoc:usage>
  </apidoc:function><apidoc:function name="element-geospatial-values" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns values from the specified element geospatial value lexicon(s).  
  Geospatial value lexicons are implemented using geospatial indexes; 
  consequently this function requires an element geospatial index for each 
  element specified  
  in the function.  If there is not a geospatial index configured for each 
  of the specified elements, an exception is thrown.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="element-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="start" type="cts:point?" optional="true">
    A starting value.  
    If the parameter value is is not in the lexicon, then the values are 
    returned beginning with the next value.  
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"ascending"</dt>
        <dd>Values should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Values should be returned in descending order.</dd>
        <dt>"any"</dt>
        <dd>Values from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Values from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Values from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Values from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Values should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Values should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included value.  
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included value. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>Use the lexicon with the coordinate system specified by 
        <em>name</em>.</dd>
        <dd>Return only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        This option does not affect the number of fragments selected 
        by the <code>cts:query</code> to calculate frequencies.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        This option affects the number of fragments selected 
        by the <code>cts:query</code> to calculate frequencies.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"type=long-lat-point"</dt>
        <dd>Specifies the format for the point in the data as longitude first, 
	latitude second.</dd>
        <dt>"type=point"</dt>
        <dd>Specifies the format for the point in the data as latitude first, 
	longitude second.  This is the default format.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include values in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included values.
    The values do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as  
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations.    
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:point*</apidoc:return>
    <apidoc:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all included values may be returned. If a <code>$query</code> parameter
  is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then values from all fragments selected by the <code>$query</code> parameter 
  are included.  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
</apidoc:usage>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  cts:element-geospatial-values(xs:QName("point"),cts:point(0,0))
  =&gt; (cts:point(0,0),cts:point(0,10),cts:point(0,20),...)
</pre></apidoc:example>
  </apidoc:function><apidoc:function name="element-child-geospatial-values" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns values from the specified element-child geospatial value lexicon(s).
  Element-child geospatial value lexicons are implemented using geospatial 
  indexes; 
  consequently this function requires an element-child geospatial index
  of for each of the element/child pairs specified in the function. 
  If there is not a range index configured for each of the specified
  element/child pairs, then an exception is thrown.  
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="element-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="child-names" type="xs:QName*" optional="false">
    One or more child element QNames.
  </apidoc:param>
      <apidoc:param name="start" type="cts:point?" optional="true">
    A starting value.  
    If the parameter value is is not in the lexicon, then the values are 
    returned beginning with the next value.  
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"ascending"</dt>
        <dd>Values should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Values should be returned in descending order.</dd>
        <dt>"any"</dt>
        <dd>Values from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Values from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Values from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Values from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Values should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Values should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included value. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included value.
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>Use the lexicon with the coordinate system specified by 
        <em>name</em>.</dd>
        <dt>"limit=<em>N</em>"</dt>
        <dd>Return no more than <em>N</em> values.</dd>
        <dt>"sample=<em>N</em>"</dt>
        <dd>Return only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"type=long-lat-point"</dt>
        <dd>Specifies the format for the point in the data as longitude first, 
	latitude second.</dd>
        <dt>"type=point"</dt>
        <dd>Specifies the format for the point in the data as latitude first, 
	longitude second.  This is the default format.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include values in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included values.
    The values do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as  
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations.
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:point*</apidoc:return>
    <apidoc:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all included values may be returned. If a <code>$query</code> parameter
  is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then values from all fragments selected by the <code>$query</code> parameter 
  are included.  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">When multiple element and/or child QNames are specified,
  then all possible element/child QName combinations are used
  to select the matching values.</p>
</apidoc:usage>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  cts:element-child-geospatial-values(
     xs:QName("location"), xs:QName("position"), cts:point(0,0) )
  =&gt; (cts:point(0,0),cts:point(0,10),cts:point(0,20),...)
</pre></apidoc:example>
  </apidoc:function><apidoc:function name="element-pair-geospatial-values" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns values from the specified element-pair geospatial value lexicon(s).
  element-pair geospatial value lexicons are implemented using geospatial 
  indexes; 
  consequently this function requires an element-pair geospatial index
  of for each of the combinatation specified in the function. 
  If there is not a geospatial index configured for each of the specified
  combinations, then an exception is thrown.  
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="element-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="latitude-names" type="xs:QName*" optional="false">
    One or more latitude element QNames.
  </apidoc:param>
      <apidoc:param name="longitude-names" type="xs:QName*" optional="false">
    One or more longitude element QNames.
  </apidoc:param>
      <apidoc:param name="start" type="cts:point?" optional="true">
    A starting value.  
    If the parameter value is is not in the lexicon, then the values are 
    returned beginning with the next value.  
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"ascending"</dt>
        <dd>Values should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Values should be returned in descending order.</dd>
        <dt>"any"</dt>
        <dd>Values from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Values from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Values from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Values from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Values should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Values should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included value. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included value.
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>Use the lexicon with the coordinate system specified by 
        <em>name</em>.</dd>
        <dt>"limit=<em>N</em>"</dt>
        <dd>Return no more than <em>N</em> values.</dd>
        <dt>"sample=<em>N</em>"</dt>
        <dd>Return only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include values in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included values.
    The values do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as  
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations.
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:point*</apidoc:return>
    <apidoc:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all included values may be returned. If a <code>$query</code> parameter
  is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then values from all fragments selected by the <code>$query</code> parameter 
  are included.  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">When multiple element and/or child QNames are specified,
  then all possible element/child QName combinations are used
  to select the matching values.</p>
</apidoc:usage>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  cts:element-pair-geospatial-values(
     xs:QName("location"), xs:QName("position"), cts:point(0,0) )
  =&gt; (cts:point(0,0),cts:point(0,10),cts:point(0,20),...)
</pre></apidoc:example>
  </apidoc:function><apidoc:function name="element-attribute-pair-geospatial-values" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns values from the specified element-attribute-pair geospatial value lexicon(s).
  element-attribute-pair geospatial value lexicons are implemented using geospatial 
  indexes; 
  consequently this function requires an element-attribute-pair geospatial index
  of for each of the combinatation specified in the function. 
  If there is not a geospatial index configured for each of the specified
  combinations, then an exception is thrown.  
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="element-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="latitude-names" type="xs:QName*" optional="false">
    One or more latitude element QNames.
  </apidoc:param>
      <apidoc:param name="longitude-names" type="xs:QName*" optional="false">
    One or more longitude element QNames.
  </apidoc:param>
      <apidoc:param name="start" type="cts:point?" optional="true">
    A starting value.  
    If the parameter value is is not in the lexicon, then the values are 
    returned beginning with the next value.  
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"ascending"</dt>
        <dd>Values should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Values should be returned in descending order.</dd>
        <dt>"any"</dt>
        <dd>Values from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Values from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Values from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Values from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Values should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Values should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included value. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included value.
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>Use the lexicon with the coordinate system specified by 
        <em>name</em>.</dd>
        <dt>"limit=<em>N</em>"</dt>
        <dd>Return no more than <em>N</em> values.</dd>
        <dt>"sample=<em>N</em>"</dt>
        <dd>Return only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include values in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included values.
    The values do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as  
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations.
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:point*</apidoc:return>
    <apidoc:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all included values may be returned. If a <code>$query</code> parameter
  is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then values from all fragments selected by the <code>$query</code> parameter 
  are included.  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">When multiple element and/or child QNames are specified,
  then all possible element/child QName combinations are used
  to select the matching values.</p>
</apidoc:usage>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  cts:element-attribute-pair-geospatial-values(
     xs:QName("location"), xs:QName("position"), cts:point(0,0) )
  =&gt; (cts:point(0,0),cts:point(0,10),cts:point(0,20),...)
</pre></apidoc:example>
  </apidoc:function><apidoc:function name="element-geospatial-value-match" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
   Returns values from the specified element geospatial value lexicon(s)
   that match the specified wildcard pattern.  Element geospatial value lexicons 
   are implemented using geospatial indexes; consequently this function 
   requires an element geospatial index for each element specified in the 
   function.  If there is not a geospatial index configured for each of the
   specified elements, then an exception is thrown. 
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="element-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="pattern" type="xs:anyAtomicType" optional="false">
    A pattern to match.  The parameter type must match the lexicon type.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"ascending"</dt>
        <dd>Values should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Values should be returned in descending order.</dd>
        <dt>"any"</dt>
        <dd>Values from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Values from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Values from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Values from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Values should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Values should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included value. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included value.
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>Use the lexicon with the coordinate system specified by 
        <em>name</em>.</dd>
        <dt>"limit=<em>N</em>"</dt>
        <dd>Return no more than <em>N</em> values.</dd>
        <dt>"sample=<em>N</em>"</dt>
        <dd>Return only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        This option does not affect the number of fragments selected 
        by the <code>cts:query</code> to calculate frequencies.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        This option affects the number of fragments selected 
        by the <code>cts:query</code> to calculate frequencies.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"type=long-lat-point"</dt>
        <dd>Specifies the format for the point in the data as longitude first, 
	latitude second.</dd>
        <dt>"type=point"</dt>
        <dd>Specifies the format for the point in the data as latitude first, 
	longitude second.  This is the default format.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include values in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included values.
    The values do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as  
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations. 
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:point*</apidoc:return>
    <apidoc:usage>
 <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all included values may be returned. If a <code>$query</code> parameter
  is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then values from all fragments selected by the <code>$query</code> parameter 
  are included.  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
</apidoc:usage>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  cts:element-geospatial-value-match(xs:QName("point"),cts:point(10,20))
  =&gt; 10,20
</pre></apidoc:example>
  </apidoc:function><apidoc:function name="element-child-geospatial-value-match" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
   Returns values from the specified element child geospatial value lexicon(s)
   that match the specified wildcard pattern.  Element 
   child geospatial value lexicons  
   are implemented using geospatial indexes; consequently this function 
   requires an element child geospatial index for each element and child 
   specified in the  
   function.  If there is not a geospatial index configured for each of the
   specified elements/child combinations, then an exception is thrown. 
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="element-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="child-names" type="xs:QName*" optional="false">
    One or more child element QNames.
  </apidoc:param>
      <apidoc:param name="pattern" type="xs:anyAtomicType" optional="false">
    A pattern to match.  The parameter type must match the lexicon type.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"ascending"</dt>
        <dd>Values should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Values should be returned in descending order.</dd>
        <dt>"any"</dt>
        <dd>Values from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Values from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Values from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Values from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Values should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Values should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included value. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included value.
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>Use the lexicon with the coordinate system specified by 
        <em>name</em>.</dd>
        <dt>"limit=<em>N</em>"</dt>
        <dd>Return no more than <em>N</em> values.</dd>
        <dt>"sample=<em>N</em>"</dt>
        <dd>Return only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        This option does not affect the number of fragments selected 
        by the <code>cts:query</code> to calculate frequencies.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        This option affects the number of fragments selected 
        by the <code>cts:query</code> to calculate frequencies.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"type=long-lat-point"</dt>
        <dd>Specifies the format for the point in the data as longitude first, 
	latitude second.</dd>
        <dt>"type=point"</dt>
        <dd>Specifies the format for the point in the data as latitude first, 
	longitude second.  This is the default format.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include values in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included values.
    The values do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as  
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations. 
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:point*</apidoc:return>
    <apidoc:usage>
 <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all included values may be returned. If a <code>$query</code> parameter
  is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then values from all fragments selected by the <code>$query</code> parameter 
  are included.  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
</apidoc:usage>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  cts:element-child-geospatial-value-match(
     xs:QName("location"),xs:QName("pos"),cts:point(10,20))
  =&gt; 10,20
</pre></apidoc:example>
  </apidoc:function><apidoc:function name="element-pair-geospatial-value-match" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
   Returns values from the specified element pair geospatial value lexicon(s)
   that match the specified wildcard pattern.  Element pair
   geospatial value lexicons 
   are implemented using geospatial indexes; consequently this function 
   requires an element pair geospatial index for each combination of elements
   specified in the 
   function.  If there is not a geospatial index configured for each of the
   specified combinations, then an exception is thrown. 
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="element-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="latitude-names" type="xs:QName*" optional="false">
    One or more latitude element QNames.
  </apidoc:param>
      <apidoc:param name="longitude-names" type="xs:QName*" optional="false">
    One or more longitude element QNames.
  </apidoc:param>
      <apidoc:param name="pattern" type="xs:anyAtomicType" optional="false">
    A pattern to match.  The parameter type must match the lexicon type.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"ascending"</dt>
        <dd>Values should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Values should be returned in descending order.</dd>
        <dt>"any"</dt>
        <dd>Values from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Values from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Values from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Values from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Values should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Values should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included value. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included value.
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>Use the lexicon with the coordinate system specified by 
        <em>name</em>.</dd>
        <dt>"limit=<em>N</em>"</dt>
        <dd>Return no more than <em>N</em> values.</dd>
        <dt>"sample=<em>N</em>"</dt>
        <dd>Return only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        This option does not affect the number of fragments selected 
        by the <code>cts:query</code> to calculate frequencies.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        This option affects the number of fragments selected 
        by the <code>cts:query</code> to calculate frequencies.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include values in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included values.
    The values do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as  
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations. 
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:point*</apidoc:return>
    <apidoc:usage>
 <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all included values may be returned. If a <code>$query</code> parameter
  is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then values from all fragments selected by the <code>$query</code> parameter 
  are included.  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
</apidoc:usage>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  cts:element-pair-geospatial-value-match(
     xs:QName("location"),xs:QName("lat"),xs:QName("long"),cts:point(10,20))
  =&gt; 10,20
</pre></apidoc:example>
  </apidoc:function><apidoc:function name="element-attribute-pair-geospatial-value-match" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
   Returns values from the specified element attribute pair geospatial value 
   lexicon(s)
   that match the specified wildcard pattern.  Element attribute pair
   geospatial value lexicons 
   are implemented using geospatial indexes; consequently this function 
   requires an element attribute pair geospatial index for each combination
   of elements and attributes specified in the 
   function.  If there is not a geospatial index configured for each of the
   specified combinations, then an exception is thrown. 
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="element-names" type="xs:QName*" optional="false">
    One or more element QNames.
  </apidoc:param>
      <apidoc:param name="latitude-names" type="xs:QName*" optional="false">
    One or more latitude element QNames.
  </apidoc:param>
      <apidoc:param name="longitude-names" type="xs:QName*" optional="false">
    One or more longitude element QNames.
  </apidoc:param>
      <apidoc:param name="pattern" type="xs:anyAtomicType" optional="false">
    A pattern to match.  The parameter type must match the lexicon type.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"ascending"</dt>
        <dd>Values should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Values should be returned in descending order.</dd>
        <dt>"any"</dt>
        <dd>Values from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Values from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Values from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Values from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Values should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Values should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included value. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included value.
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>Use the lexicon with the coordinate system specified by 
        <em>name</em>.</dd>
        <dt>"limit=<em>N</em>"</dt>
        <dd>Return no more than <em>N</em> values.</dd>
        <dt>"sample=<em>N</em>"</dt>
        <dd>Return only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        This option does not affect the number of fragments selected 
        by the <code>cts:query</code> to calculate frequencies.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only values from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        This option affects the number of fragments selected 
        by the <code>cts:query</code> to calculate frequencies.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include values in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included values.
    The values do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as  
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations. 
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:point*</apidoc:return>
    <apidoc:usage>
 <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all included values may be returned. If a <code>$query</code> parameter
  is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then values from all fragments selected by the <code>$query</code> parameter 
  are included.  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
</apidoc:usage>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  cts:element-attribute-pair-geospatial-value-match(
     xs:QName("location"),xs:QName("lat"),xs:QName("long"),cts:point(10,20))
  =&gt; 10,20
</pre></apidoc:example>
  </apidoc:function><apidoc:function name="element-value-geospatial-co-occurrences" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns value co-occurrences from the specified element
  value lexicon with the specified geospatial lexicon.
  Value lexicons are implemented using range indexes; 
  consequently this function requires a range index for the element
  specified in the function.  
  If there is not a range index configured for the specified 
  element, then an exception is thrown. 
  Geospatial lexicons are implemented using geospatial indexes;
  consequently this function requires a geospatial index for the 
  element/attribute combination specified in the function.  
  If there is not a geospatial index configured for the specified 
  element/attribute combination, then an exception is thrown. 
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="element-name-1" type="xs:QName" optional="false">
    An element QName.
  </apidoc:param>
      <apidoc:param name="geo-element-name" type="xs:QName" optional="false">
    An element QName.
  </apidoc:param>
      <apidoc:param name="child-name-1" type="xs:QName?" optional="false">
    An element or attribute QName or empty sequence.
    The empty sequence specifies an element geospatial lexicon.
  </apidoc:param>
      <apidoc:param name="child-name-2" type="xs:QName?" optional="false">
    An element or attribute QName or empty sequence.
    The empty sequence specifies either an element lexicon or an 
    element-child geospatial lexicon.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"geospatial-format=<em>format</em>"</dt>
        <dd>Use the kind of geospatial lexicon specified by <em>format</em> 
        (element, element-child, element-pair, or element-attribute-pair).
        If neither of the child QNames is specified, the default is
        "element"; if only the first of the child QNames is specified,
        the default is "element-child:; if both child QNames are specified,
        the default is "element-pair".  If the selection is not compatible
        with the number of geospatial QNames specified, an error is raised.
        </dd>
        <dt>"ascending"</dt>
        <dd>Co-occurrences should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Co-occurrences should be returned in descending order.</dd>
        <dt>"any"</dt>
        <dd>Co-occurrences from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Co-occurrences from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Co-occurrences from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Co-occurrences from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Co-occurrences should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Co-occurrences should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included co-occurrences.  
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included co-occurrence. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"type=<em>type</em>"</dt>
        <dd>For the non-geospatial lexicon, use the type specified by 
        <em>type</em> (int, unsignedInt, long, unsignedLong, float, double, 
        decimal, dateTime, time, date, gYearMonth, gYear, gMonth, gDay, 
        yearMonthDuration, dayTimeDuration, string, or anyURI)</dd>
        <dt>"type-2=<em>type</em>"</dt>
        <dd>For the geospatial lexicon, use the type specified by 
        <em>type-2</em> (point or long-lat-point)</dd>
        <dt>"collation=<em>URI</em>"</dt>
        <dd>For the non-geospatial lexicon, use the collation specified by 
        <em>URI</em>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>For the geospatial lexicons, use the coordinate system specified 
        by <em>name</em>.</dd>
        <dt>"timezone=<em>TZ</em>"</dt>
        <dd>Return timezone sensitive values (dateTime, time, date, 
        gYearMonth, gYear, gMonth, and gDay) adjusted to the timezone
        specified by <em>TZ</em>.  
        Example timezones: Z, -08:00, +01:00.</dd>
        <dt>"ordered"</dt>
        <dd>Include co-occurrences only when the value from the first lexicon
        appears before the value from the second lexicon.
        Requires that word positions be enabled for both lexicons.</dd>
        <dt>"reversed"</dt>
        <dd>Consider the second lexicon as the first and vice versa.</dd>
        <dt>"proximity=<em>N</em>"</dt>
        <dd>Include co-occurrences only when the values appear within 
        <em>N</em> words of each other.
        Requires that word positions be enabled for both lexicons.</dd>
        <dt>"limit=<em>N</em>"</dt>
        <dd>Return no more than <em>N</em> co-occurrences.</dd>
        <dt>"sample=<em>N</em>"</dt>
        <dd>Return only co-occurrences from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only co-occurrences from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include co-occurrences in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included co-occurrences.
    The co-occurrences do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as  
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations.    
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>item()*</apidoc:return>
    <apidoc:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "collation=<em>URI</em>" is not specified in the options parameter,
  then the default collation is used. If a lexicon with that collation
  does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all included co-occurrences may be returned.  
  If a <code>$query</code> parameter
  is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then co-occurrences from all fragments selected by the 
  <code>$query</code> parameter are included.  
  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
</apidoc:usage>
  </apidoc:function><apidoc:function name="element-attribute-value-geospatial-co-occurrences" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns value co-occurrences from the specified element-attribute
  value lexicon with the specified geospatial lexicon.
  Value lexicons are implemented using range indexes; 
  consequently this function requires a range index for the element and attribute
  pair specified in the function.  
  If there is not a range index configured for the specified 
  element and attribute pair, then an exception is thrown. 
  Geospatial lexicons are implemented using geospatial indexes;
  consequently this function requires a geospatial index for the 
  element/attribute combination specified in the function.  
  If there is not a geospatial index configured for the specified 
  element/attribute combination, then an exception is thrown. 
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="element-name-1" type="xs:QName" optional="false">
    An element QName.
  </apidoc:param>
      <apidoc:param name="attribute-name-1" type="xs:QName?" optional="false">
    An attribute QName.
  </apidoc:param>
      <apidoc:param name="geo-element-name" type="xs:QName" optional="false">
    An element QName.
  </apidoc:param>
      <apidoc:param name="child-name-1" type="xs:QName?" optional="false">
    An element or attribute QName or empty sequence.
    The empty sequence specifies an element geospatial lexicon.
  </apidoc:param>
      <apidoc:param name="child-name-2" type="xs:QName?" optional="false">
    An element or attribute QName or empty sequence.
    The empty sequence specifies either an element lexicon or an 
    element-child geospatial lexicon.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"geospatial-format=<em>format</em>"</dt>
        <dd>Use the kind of geospatial lexicon specified by <em>format</em> 
        (element, element-child, element-pair, or element-attribute-pair).
        If neither of the child QNames is specified, the default is
        "element"; if only the first of the child QNames is specified,
        the default is "element-child:; if both child QNames are specified,
        the default is "element-pair".  If the selection is not compatible
        with the number of geospatial QNames specified, an error is raised.
        </dd>
        <dt>"ascending"</dt>
        <dd>Co-occurrences should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Co-occurrences should be returned in descending order.</dd>
        <dt>"any"</dt>
        <dd>Co-occurrences from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Co-occurrences from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Co-occurrences from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Co-occurrences from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Co-occurrences should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Co-occurrences should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included co-occurrences.  
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included co-occurrence. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"type=<em>type</em>"</dt>
        <dd>For the non-geospatial lexicon, use the type specified by 
        <em>type</em> (int, unsignedInt, long, unsignedLong, float, double, 
        decimal, dateTime, time, date, gYearMonth, gYear, gMonth, gDay, 
        yearMonthDuration, dayTimeDuration, string, or anyURI)</dd>
        <dt>"collation=<em>URI</em>"</dt>
        <dd>For the non-geospatial lexicon, use the collation specified by 
        <em>URI</em>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>For the geospatial lexicons, use the coordinate system specified
        by <em>name</em>.</dd>
        <dt>"timezone=<em>TZ</em>"</dt>
        <dd>Return timezone sensitive values (dateTime, time, date, 
        gYearMonth, gYear, gMonth, and gDay) adjusted to the timezone
        specified by <em>TZ</em>.  
        Example timezones: Z, -08:00, +01:00.</dd>
        <dt>"ordered"</dt>
        <dd>Include co-occurrences only when the value from the first lexicon
        appears before the value from the second lexicon.
        Requires that word positions be enabled for both lexicons.</dd>
        <dt>"reversed"</dt>
        <dd>Consider the second lexicon as the first and vice versa.</dd>
        <dt>"proximity=<em>N</em>"</dt>
        <dd>Include co-occurrences only when the values appear within 
        <em>N</em> words of each other.
        Requires that word positions be enabled for both lexicons.</dd>
        <dt>"limit=<em>N</em>"</dt>
        <dd>Return no more than <em>N</em> co-occurrences.</dd>
        <dt>"sample=<em>N</em>"</dt>
        <dd>Return only co-occurrences from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only co-occurrences from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include co-occurrences in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included co-occurrences.
    The co-occurrences do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as  
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations.    
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>item()*</apidoc:return>
    <apidoc:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "collation=<em>URI</em>" is not specified in the options parameter,
  then the default collation is used. If a lexicon with that collation
  does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all included co-occurrences may be returned.  
  If a <code>$query</code> parameter
  is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then co-occurrences from all fragments selected by the 
  <code>$query</code> parameter are included.  
  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
</apidoc:usage>
  </apidoc:function><apidoc:function name="geospatial-co-occurrences" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial Lexicon" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns value co-occurrences from the geospatial lexicons.
  Geospatial lexicons are implemented using geospatial indexes;
  consequently this function requires a geospatial index for each
  combination of elements and attributes specified in the function.  
  If there is not a geospatial index configured for the specified 
  element/attribute combination, then an exception is thrown. 
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="geo-element-name-1" type="xs:QName" optional="false">
    An element QName.
  </apidoc:param>
      <apidoc:param name="child-1-name-1" type="xs:QName?" optional="false">
    An element or attribute QName or empty sequence.
    The empty sequence specifies an element geospatial lexicon.
  </apidoc:param>
      <apidoc:param name="child-1-name-2" type="xs:QName?" optional="false">
    An element or attribute QName or empty sequence.
    The empty sequence specifies either an element lexicon or an 
    element-child geospatial lexicon.
  </apidoc:param>
      <apidoc:param name="geo-element-name-2" type="xs:QName" optional="false">
    An element QName.
  </apidoc:param>
      <apidoc:param name="child-2-name-1" type="xs:QName?" optional="false">
    An element or attribute QName or empty sequence.
    The empty sequence specifies an element geospatial lexicon.
  </apidoc:param>
      <apidoc:param name="child-2-name-2" type="xs:QName?" optional="false">
    An element or attribute QName or empty sequence.
    The empty sequence specifies either an element lexicon or an 
    element-child geospatial lexicon.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
    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>"geospatial-format=<em>format</em>"</dt>
        <dd>For both geospatial lexicons, use the kind of geospatial lexicon
        specified by <em>format</em> 
        (element, element-child, element-pair, or element-attribute-pair).
        If neither of the child QNames is specified, the default is
        "element"; if only the first of the child QNames is specified,
        the default is "element-child:; if both child QNames are specified,
        the default is "element-pair".  If the selection is not compatible
        with the number of geospatial QNames specified, an error is raised.
        </dd>
        <dt>"geospatial-format-1=<em>format</em>"</dt>
        <dd>For the first geospatial lexicon, use the kind of geospatial lexicon
        specified by <em>format</em> 
        (element, element-child, element-pair, or element-attribute-pair).
        If neither of the child QNames is specified, the default is
        "element"; if only the first of the child QNames is specified,
        the default is "element-child:; if both child QNames are specified,
        the default is "element-pair".  If the selection is not compatible
        with the number of geospatial QNames specified, an error is raised.
        </dd>
        <dt>"geospatial-format-2=<em>format</em>"</dt>
        <dd>For the second geospatial lexicons, use the kind of geospatial 
        lexicon specified by <em>format</em> 
        (element, element-child, element-pair, or element-attribute-pair).
        If neither of the child QNames is specified, the default is
        "element"; if only the first of the child QNames is specified,
        the default is "element-child:; if both child QNames are specified,
        the default is "element-pair".  If the selection is not compatible
        with the number of geospatial QNames specified, an error is raised.
        </dd>
        <dt>"ascending"</dt>
        <dd>Co-occurrences should be returned in ascending order.</dd>
        <dt>"descending"</dt>
        <dd>Co-occurrences should be returned in descending order.</dd>
        <dt>"any"</dt>
        <dd>Co-occurrences from any fragment should be included.</dd>
        <dt>"document"</dt>
        <dd>Co-occurrences from document fragments should be included.</dd>
        <dt>"properties"</dt>
        <dd>Co-occurrences from properties fragments should be included.</dd>
        <dt>"locks"</dt>
        <dd>Co-occurrences from locks fragments should be included.</dd>
        <dt>"frequency-order"</dt>
        <dd>Co-occurrences should be returned ordered by frequency.</dd>
        <dt>"item-order"</dt>
        <dd>Co-occurrences should be returned ordered by item.</dd>
        <dt>"fragment-frequency"</dt>
        <dd>Frequency should be the number of fragments with
        an included co-occurrences.  
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"item-frequency"</dt>
        <dd>Frequency should be the number of occurences of
        an included co-occurrence. 
        This option is used with <code>cts:frequency</code>.</dd>
        <dt>"coordinate-system=<em>URI</em>"</dt>
        <dd>For both geospatial lexicons, use the coordinate system specified by 
        <em>name</em>.</dd>
        <dt>"coordinate-system-1=<em>URI</em>"</dt>
        <dd>For the first geospatial lexicon, use the coordinate system 
        specified by <em>name</em>.</dd>
        <dt>"coordinate-system-2=<em>URI</em>"</dt>
        <dd>For the second geospatial lexicons, use the coordinate system 
        specified by <em>name</em>.</dd>
        <dt>"ordered"</dt>
        <dd>Include co-occurrences only when the value from the first lexicon
        appears before the value from the second lexicon.
        Requires that word positions be enabled for both lexicons.</dd>
        <dt>"reversed"</dt>
        <dd>Consider the second lexicon as the first and vice versa.</dd>
        <dt>"proximity=<em>N</em>"</dt>
        <dd>Include co-occurrences only when the values appear within 
        <em>N</em> words of each other.
        Requires that word positions be enabled for both lexicons.</dd>
        <dt>"limit=<em>N</em>"</dt>
        <dd>Return no more than <em>N</em> co-occurrences.</dd>
        <dt>"sample=<em>N</em>"</dt>
        <dd>Return only co-occurrences from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"truncate=<em>N</em>"</dt>
        <dd>Include only co-occurrences from the first <em>N</em> fragments
        selected by the <code>cts:query</code>.
        Only applies when a <code>$query</code> parameter is specified.</dd>
        <dt>"score-logtfidf"</dt>
        <dd>Compute scores using the logtfidf method.</dd>
        <dt>"score-logtf"</dt>
        <dd>Compute scores using the logtf method.</dd>
        <dt>"score-simple"</dt>
        <dd>Compute scores using the simple method.</dd>
        <dt>"score-random"</dt>
        <dd>Compute scores using the random method.</dd>
        <dt>"checked"</dt>
        <dd>Word positions should be checked when resolving the query.</dd>
        <dt>"unchecked"</dt>
        <dd>Word positions should not be checked when resolving the query.</dd>
        <dt>"concurrent"</dt>
        <dd>Perform the work concurrently in another thread. This is a hint 
        to the query optimizer to help parallelize the lexicon work, allowing
        the calling query to continue performing other work while the lexicon 
        processing occurs.  This is especially useful in cases where multiple 
        lexicon calls occur in the same query (for example, resolving many 
        facets in a single query).</dd>
     </dl></blockquote>
  </apidoc:param>
      <apidoc:param name="query" type="cts:query?" optional="true">
    Only include co-occurrences in fragments selected by the <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code>, 
    and compute frequencies from this set of included co-occurrences.
    The co-occurrences do not need to match the query, but they must occur in
    fragments selected by the query.
    The fragments are not filtered to ensure they match the query, 
    but instead selected in the same manner as  
    <a href="cts:search#unfiltered" xmlns="http://www.w3.org/1999/xhtml">
    "unfiltered" <code>cts:search</code></a> operations.    
  </apidoc:param>
      <apidoc:param name="quality-weight" type="xs:double?" optional="true">
    A document quality weight to use when computing scores.
    The default is 1.0.
  </apidoc:param>
      <apidoc:param name="forest-ids" type="xs:unsignedLong*" optional="true">
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is ().
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>item()*</apidoc:return>
    <apidoc:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "frequency-order" or "item-order" may be specified 
  in the options parameter.  If neither "frequency-order" nor "item-order" 
  is specified, then the default is "item-order".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "fragment-frequency" or "item-frequency" may be specified 
  in the options parameter.  If neither "fragment-frequency" nor 
  "item-frequency" is specified, then the default is "fragment-frequency".</p>
  <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" if "item-order" is
  specified, and "descending" if "frequency-order" is specified.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of "any", "document", "properties", or "locks" 
  may be specified in the options parameter.
  If none of "any", "document", "properties", or "locks" are specified
  and there is a $query parameter, then the default is "document".
  If there is no $query parameter then the default is "any".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "score-logtfidf", "score-logtf", "score-simple",
  or "score-random" options may be specified in the options parameter. 
  If none of "score-logtfidf", "score-logtf", "score-simple", or 
  "score-random" are specified, then the default is "score-logtfidf".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">Only one of the "checked" or "unchecked" options may be specified
  in the options parameter. 
  If neither "checked" nor "unchecked" are specified,
  then the default is "checked".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "coordinate-system=<em>name</em>" is not specified in the options
  parameter, then the default coordinate system is used. If a lexicon with
  that coordinate system does not exist, an error is thrown.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "sample=<em>N</em>" is not specfied in the options parameter, 
  then all included co-occurrences may be returned.  
  If a <code>$query</code> parameter
  is not present, then "sample=<em>N</em>" has no effect.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If "truncate=<em>N</em>" is not specfied in the options parameter, 
  then co-occurrences from all fragments selected by the 
  <code>$query</code> parameter are included.  
  If a <code>$query</code> parameter is not present, then  
  "truncate=<em>N</em>" has no effect.</p>
</apidoc:usage>
  </apidoc:function><apidoc:function name="distance" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the distance (in miles) between two points.  
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="p1" type="cts:point" optional="false">
  The first point.
  </apidoc:param>
      <apidoc:param name="p2" type="cts:point" optional="false">
  The second point.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
  Options for the operation. The default is ().
  <p xmlns="http://www.w3.org/1999/xhtml">Options include:</p>
  <blockquote xmlns="http://www.w3.org/1999/xhtml">
     <dl>
     <dt>"coordinate-system=wgs84"</dt>
     <dd>Use the WGS84 coordinate system.</dd>
     <dt>"units=miles"</dt>
     <dd>Distance is measured in miles.</dd>
     </dl>
   </blockquote>
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:double</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $sf := cts:point(37, -122)
let $ny := cts:point(40, -73)
return
cts:distance($sf, $ny)

=&gt; 2626.42211914063
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="shortest-distance" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the great circle distance (in miles) between a point and an 
  arc.  The arc is defined by a pair of points.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="p1" type="cts:point" optional="false">
  The first point.
  </apidoc:param>
      <apidoc:param name="v" type="cts:point+" optional="false">
  A sequence of points defining (pairwise) a sequence of arcs.
  </apidoc:param>
      <!-- Or a region: circle, box, polygon, linestring, or complex-polygon:
  Return 0 if point is in region or shortest-distance to boundary otherwise.
  -->
      <apidoc:param name="options" type="xs:string*" optional="true">
  Options for the operation. The default is ().
  <p xmlns="http://www.w3.org/1999/xhtml">Options include:</p>
  <blockquote xmlns="http://www.w3.org/1999/xhtml">
     <dl>
     <dt>"coordinate-system=wgs84"</dt>
     <dd>Use the WGS84 coordinate system.</dd>
     <dt>"units=miles"</dt>
     <dd>Distance is measured in miles.</dd>
     </dl>
   </blockquote>
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:double</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="bearing" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the true bearing in radians of the path from the first point
  to the second.  An error is raised if the two points are the same.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="p1" type="cts:point" optional="false">
  The first point.
  </apidoc:param>
      <apidoc:param name="p2" type="cts:point" optional="false">
  The second point.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
  Options for the operation. The default is ().
  <p xmlns="http://www.w3.org/1999/xhtml">Options include:</p>
  <blockquote xmlns="http://www.w3.org/1999/xhtml">
     <dl>
     <dt>"coordinate-system=wgs84"</dt>
     <dd>Use the WGS84 coordinate system.</dd>
     </dl>
   </blockquote>
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>xs:double</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $sf := cts:point(37, -122)
let $ny := cts:point(40, -73)
return
cts:bearing($sf, $ny)

=&gt; 1.22100904274442
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="destination" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the point at the given distance (in miles) along the given 
  bearing (in radians) from the starting point.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="p" type="cts:point" optional="false">
  The starting point.
  </apidoc:param>
      <apidoc:param name="bearing" type="xs:double" optional="false">
  The bearing, in radians.
  </apidoc:param>
      <apidoc:param name="distance" type="xs:double" optional="false">
  The distance, in miles.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
  Options for the operation. The default is ().
  <p xmlns="http://www.w3.org/1999/xhtml">Options include:</p>
  <blockquote xmlns="http://www.w3.org/1999/xhtml">
     <dl>
     <dt>"coordinate-system=wgs84"</dt>
     <dd>Use the WGS84 coordinate system.</dd>
     <dt>"units=miles"</dt>
     <dd>Distance is measured in miles.</dd>
     </dl>
   </blockquote>
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:point</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $sf := cts:point(37, -122)
let $ny := cts:point(40, -73)
return
cts:destination($sf,1.22100904274442,2626.42211914063)

=&gt; 
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function><apidoc:function name="arc-intersection" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Geospatial" hidden="false" bucket="MarkLogic Built-In Functions">
    <apidoc:summary>
  Returns the point at the intersection of two arcs. If the arcs do
  not intersect, or lie on the same great circle, or if either arc covers
  more than 180 degrees, an error is raised.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="p1" type="cts:point" optional="false">
  The starting point of the first arc.
  </apidoc:param>
      <apidoc:param name="p2" type="cts:point" optional="false">
  The ending point of the first arc.
  </apidoc:param>
      <apidoc:param name="q1" type="cts:point" optional="false">
  The starting point of the second arc.
  </apidoc:param>
      <apidoc:param name="q2" type="cts:point" optional="false">
  The ending point of the second arc.
  </apidoc:param>
      <apidoc:param name="options" type="xs:string*" optional="true">
  Options for the operation. The default is ().
  <p xmlns="http://www.w3.org/1999/xhtml">Options include:</p>
  <blockquote xmlns="http://www.w3.org/1999/xhtml">
     <dl>
     <dt>"coordinate-system=wgs84"</dt>
     <dd>Use the WGS84 coordinate system.</dd>
     </dl>
   </blockquote>
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>cts:point</apidoc:return>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
let $sf := cts:point(37, -122)
let $ny := cts:point(40, -73)
let $a := cts:point(35,-100)
let $b := cts:point(41,-70)
return
cts:arc-intersection($sf,$ny,$a,$b)

=&gt; 40.458347,-76.203682
</pre></apidoc:example>
    <algorithm xmlns="http://www.w3.org/1999/xhtml"></algorithm>
  </apidoc:function></apidoc:module>