cts:word-query( $text as xs:string*, [$options as xs:string*], [$weight as xs:double?] ) as cts:word-query
Returns a query matching text content containing a given phrase.
Parameters | |
---|---|
text | Some words or phrases to match. When multiple strings are specified, the query matches if any string matches. |
options |
Options to this query. The default is ().
Options include:
|
weight | A weight for this query. Higher weights move search results up in the relevance order. The default is 1.0. The weight should be between 64 and -16. Weights greater than 64 will have the same effect as a weight of 64. Weights less than the absolute value of 0.0625 (between -0.0625 and 0.0625) are rounded to 0, which means that they do not contribute to the score. |
If neither "case-sensitive" nor "case-insensitive" is present, $text is used to determine case sensitivity. If $text contains no uppercase, it specifies "case-insensitive". If $text contains uppercase, it specifies "case-sensitive".
If neither "diacritic-sensitive" nor "diacritic-insensitive" is present, $text is used to determine diacritic sensitivity. If $text contains no diacritics, it specifies "diacritic-insensitive". If $text contains diacritics, it specifies "diacritic-sensitive".
If neither "punctuation-sensitive" nor "punctuation-insensitive" is present, $text is used to determine punctuation sensitivity. If $text contains no punctuation, it specifies "punctuation-insensitive". If $text contains punctuation, it specifies "punctuation-sensitive".
If neither "whitespace-sensitive" nor "whitespace-insensitive" is present, the query is "whitespace-insensitive".
If neither "wildcarded" nor "unwildcarded" is present, the database configuration and $text determine wildcarding. If the database has any wildcard indexes enabled ("three character searches", "two character searches", "one character searches", or "trailing wildcard searches") and if $text contains either of the wildcard characters '?' or '*', it specifies "wildcarded". Otherwise it specifies "unwildcarded".
If neither "stemmed" nor "unstemmed" is present, the database configuration determines stemming. If the database has "stemmed searches" enabled, it specifies "stemmed". Otherwise it specifies "unstemmed". If the query is a wildcarded query and also a phrase query (contains two or more terms), the wildcard terms in the query are unstemmed.
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.
Relevance adjustment for the "distance-weight" option depends on the closest proximity of any two matches of the query. For example,
cts:word-query(("dog","cat"),("distance-weight=10"))will adjust relevance based on the distance between the closest pair of matches of either "dog" or "cat" (the pair may consist only of matches of "dog", only of matches of "cat", or a match of "dog" and a match of "cat").
cts:search(//function, cts:word-query("MarkLogic Corporation")) => .. relevance-ordered sequence of 'function' element ancestors (or self) of any node containing the phrase 'MarkLogic Corporation'.
cts:search(//function, cts:word-query("MarkLogic Corporation", "case-insensitive")) => .. relevance-ordered sequence of 'function' element ancestors (or self) of any node containing the phrase 'MarkLogic Corporation' or any other case-shift like 'MarkLogic Corporation', 'MARKLOGIC Corporation', etc.
cts:search(//SPEECH, cts:word-query("to be, or not to be", "punctuation-insensitive")) => .. relevance-ordered sequence of 'SPEECH' element ancestors (or self) of any node containing the phrase 'to be, or not to be', ignoring punctuation.
(: the following query uses the "synonym" option to make the terms "cat" and "kitty" treated the same for scoring purposes :) cts:search(fn:collection(), cts:word-query(("cat", "kitty"), "synonym") ) => Returns relevance-ordered documents containing at least one of the specified terms, where the words "cat" and "kitty" are treated, for scoring purposes, as if they are both the word "cat". Without the synonym option, there would be one contribution to the score from "cat" matches and one from "kitty" matches.