Loading TOC...

cts.periodRangeQuery

cts.periodRangeQuery(
   $axis-name as String[],
   $operator as String,
   [$period as cts.period[]],
   [$options as String[]]
) as cts.periodRangeQuery

Summary

Returns a cts:query matching axis by name with a period value with an operator. Searches with the cts:period-range-query constructor require a axis definition on the axis name; if there is no axis configured, then an exception is thrown.

Parameters
$axis-name One or more axis to match on.
$operator A comparison operator.

Operators include:

"aln_equals"
Match documents whose period1 equals value.
"aln_contains"
Match documents whose period1 contains value. i.e. period1 starts before value starts and ends before value ends.
"aln_contained_by"
Match documents whose period1 is contained by value.
"aln_meets"
Match documents whose period1 meets value, i.e. period1 ends at value start.
"aln_met_by"
Match documents whose period1 meets value, i.e. period1 starts at value end.
"aln_before"
Match documents whose period1 is before value, i.e. period1 ends before value starts.
"aln_after"
Match documents whose period1 is after value, i.e. period1 starts after value ends.
"aln_starts"
Match documents whose period1 starts value, i.e. period1 starts at value start and ends before value ends.
"aln_started_by"
Match documents whose value starts period1, i.e. period1 starts at value start and ends after value ends.
"aln_finishes"
Match documents whose period1 finishes value, i.e. period1 finishes at value finish and starts after value starts.
"aln_finished_by"
Match documents whose value finishes period1, i.e. period1 finishes at value finish and starts before value starts.
"aln_overlaps"
Match documents whose period1 overlaps value, i.e. period1 starts before value start and ends before value ends but after value starts.
"aln_overlapped_by"
Match documents whose value overlaps period1, i.e. period1 starts after value start but before value ends and ends after value ends.
"iso_contains"
Match documents whose period1 contains value in sql 2011 standard. i.e. period1 starts before or at value starts and ends after or at value ends.
"iso_overlaps"
Match documents whose period1 overlaps value in sql 2011 standard. i.e. period1 and value have common time period.
"iso_succeeds"
Match documents whose period1 succeeds value in sql 2011 standard. i.e. period1 starts at or after value ends
"iso_precedes"
Match documents whose period1 precedes value in sql 2011 standard. i.e. period1 ends at or before value ends
"iso_imm_succeeds"
Match documents whose period1 immediately succeeds value in sql 2011 standard. i.e. period1 starts at value end
"iso_imm_precedes"
Match documents whose period1 immediately precedes value in sql 2011 standard. i.e. period1 ends at value end
$period the cts:period to perform operations on. When multiple values are specified, the query matches if any value matches.
$options Options to this query. The default is ().

Options include:

"cached"
Cache the results of this query in the list cache.
"uncached"
Do not cache the results of this query in the list cache.
"min-occurs=number"
Specifies the minimum number of occurrences required. If fewer that this number of words occur, the fragment does not match. The default is 1.
"max-occurs=number"
Specifies the maximum number of occurrences required. If more than this number of words occur, the fragment does not match. The default is unbounded.
"score-function=function"
Use the selected scoring function. The score function may be:
linear
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.
reciprocal
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.
zero
This range query does not contribute to the score. This is the default.
"slope-factor=number"
Apply the given number as a scaling factor to the slope of the scoring function. The default is 1.0.

Usage Notes

If you want to constrain on a range of values, you can combine multiple cts:period-range-query constructors together with cts:and-query or any of the other composable cts:query constructors, as in the last part of the example below.

If neither "cached" nor "uncached" is present, it specifies "cached".

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.

"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.

Example

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);
  => document matching the range query

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy