<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/cts.periodRangeQuery.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>cts.periodRangeQuery</api:function-name><api:suggest>cts.periodrangequery</api:suggest><api:suggest>cts</api:suggest><api:suggest>periodrangequery</api:suggest><api:function-link mode="xquery" fullname="cts:period-range-query">/apidoc/8.0/cts:period-range-query.xml</api:function-link><api:function mode="javascript" name="periodRangeQuery" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions" prefix="cts" namespace="http://marklogic.com/cts" fullname="cts.periodRangeQuery"><api:summary>
  Returns a <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code> matching period by name with a
  period value with an operator.  Searches with the
  <code xmlns="http://www.w3.org/1999/xhtml">cts:period-range-query</code>
  constructor require a period definition on the period name;
  if there is no period configured, then an exception is thrown.
</api:summary><api:params><api:param name="axis-name" type="xs:string*"><api:param-description>
    One or more axis to match on.
  </api:param-description><api:param-name>axis-name</api:param-name><api:param-type>String[]</api:param-type></api:param><api:param name="operator" type="xs:string"><api:param-description>
    A comparison operator.
    <p xmlns="http://www.w3.org/1999/xhtml">
      Operators include:</p>
      <blockquote xmlns="http://www.w3.org/1999/xhtml"><dl>
        <dt>"aln_equals"</dt>
        <dd>Match documents whose period1 equals value.</dd>
        <dt>"aln_contains"</dt>
        <dd>Match documents whose period1 contains value. i.e. period1 starts 
	before value starts and ends before value ends.</dd>
        <dt>"aln_contained_by"</dt>
        <dd>Match documents whose period1 is contained by value.</dd>
        <dt>"aln_meets"</dt>
        <dd>Match documents whose period1 meets value, i.e. period1 ends at 
	value start.</dd>
        <dt>"aln_met_by"</dt>
        <dd>Match documents whose period1 meets value, i.e. period1 starts at 
	value end.</dd>
        <dt>"aln_before"</dt>
        <dd>Match documents whose period1 is before value, i.e. period1 ends 
	before value starts.</dd>
        <dt>"aln_after"</dt>
        <dd>Match documents whose period1 is after value, i.e. period1 starts 
	after value ends.</dd>
        <dt>"aln_starts"</dt>
        <dd>Match documents whose period1 starts value, i.e. period1 starts at 
	value start and ends before value ends.</dd>
        <dt>"aln_started_by"</dt>
        <dd>Match documents whose value starts period1, i.e. period1 starts at 
	value start and ends after value ends.</dd>
        <dt>"aln_finishes"</dt>
        <dd>Match documents whose period1 finishes value, i.e. period1 
	finishes at value finish and starts after value starts.</dd>
        <dt>"aln_finished_by"</dt>
        <dd>Match documents whose value finishes period1, i.e. period1 
	finishes at value finish and starts before value starts.</dd>
        <dt>"aln_overlaps"</dt>
        <dd>Match documents whose period1 overlaps value, i.e. period1 starts 
	before value start and ends before value ends but after value 
	starts.</dd>
        <dt>"aln_overlapped_by"</dt>
        <dd>Match documents whose value overlaps period1, i.e. period1 
	starts after value start but before value ends annd ends after 
	value ends.</dd>
        <dt>"iso_contains"</dt>
        <dd>Match documents whose period1 contains value in sql 2011 standard.
        i.e. period1 starts before or at value starts and ends before or at 
	value ends.</dd>
        <dt>"iso_overlaps"</dt>
        <dd>Match documents whose period1 overlaps value in sql 2011 standard.
        i.e. period1 and value have common time period.</dd>
        <dt>"iso_succeeds"</dt>
        <dd>Match documents whose period1 succeeds value in sql 2011 standard.
        i.e. period1 starts at or after value ends</dd>
        <dt>"iso_precedes"</dt>
        <dd>Match documents whose period1 precedes value in sql 2011 standard.
        i.e. period1 ends at or before value ends</dd>
        <dt>"iso_imm_succeeds"</dt>
        <dd>Match documents whose period1 immediately succeeds value in 
	sql 2011 standard.
        i.e. period1 starts at value end</dd>
        <dt>"iso_imm_precedes"</dt>
        <dd>Match documents whose period1 immediately precedes value in 
	sql 2011 standard.
        i.e. period1 ends at value end</dd>
      </dl></blockquote>
  </api:param-description><api:param-name>operator</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="period" type="cts:period*" optional="true"><api:param-description>
    the cts:period to perform operations on.
    When multiple values are specified,
    the query matches if any value matches.
  </api:param-description><api:param-name>period</api:param-name><api:param-type>cts.period[]</api:param-type></api:param><api:param name="options" type="xs:string*" optional="true"><api:param-description>
    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>"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>"min-occurs=<em>number</em>"</dt>
        <dd>Specifies the minimum number of occurrences required. If
        fewer that this number of words occur, the fragment does not match.
        The default is 1.</dd>
        <dt>"max-occurs=<em>number</em>"</dt>
        <dd>Specifies the maximum number of occurrences required.  If
        more than this number of words occur, the fragment does not match.
        The default is unbounded.</dd>
        <dt>"score-function=<em>function</em>"</dt>
        <dd>Use the selected scoring function. The score function may be:
          <dl>
          <dt>linear</dt><dd>Use a linear function of the difference between the
          specified query value and the matching value in the index to calculate
          a score for this range query.</dd>
          <dt>reciprocal</dt><dd>Use a reciprocal function of the difference
          between the specified query value and the matching value in the
          index to calculate a score for this range query.</dd>
          </dl>
          <dt>zero</dt><dd>This range query does not contribute to the
          score. This is the default.</dd>
        </dd>
        <dt>"slope-factor=<em>number</em>"</dt>
        <dd>Apply the given number as a scaling factor to the slope of the
        scoring function. The default is 1.0.</dd>
      </dl></blockquote>
  </api:param-description><api:param-name>options</api:param-name><api:param-type>String[]</api:param-type></api:param></api:params><api:return>cts.periodRangeQuery</api:return><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">If you want to constrain on a range of values, you can combine multiple
  <code>cts:period-range-query</code> constructors together
  with <code>cts:and-query</code> or any of the other composable
  <code>cts:query</code> constructors, as in the last part of the example
  below.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If neither "cached" nor "uncached" is present, it specifies "cached".</p>
  <p xmlns="http://www.w3.org/1999/xhtml">
    Negative "min-occurs" or "max-occurs" values will be treated as 0 and
    non-integral values will be rounded down.  An error will be raised if
    the "min-occurs" value is greater than the "max-occurs" value.
  </p>
  <p xmlns="http://www.w3.org/1999/xhtml">"score-function=linear" means that values that are further away from
  the bounds will score higher. "score-function=reciprocal" means that values
  that are closer to the bounds will score higher. The functions are scaled
  appropriately for different types, so that in general the default slope 
  factor will provide useful results. Using a slope factor greater than 
  1 gives distinct scores over a smaller range of values, and produces 
  generally higher scores.  Using a slope factor less than 1 gives 
  distinct scores over a wider range of values, and produces generally 
  lower scores.
  </p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var period = cts.period(xs.dateTime("2001-05-31T09:30:10-08:00"),
                        xs.dateTime("2003-05-31T09:30:10-08:00"));
var query = cts.periodRangeQuery("period1","aln_equals", period);
cts.search(query);
  =&gt; document matching the range query
</pre></api:example></api:function></api:function-page>