[ You are here:
XTF ->
Tag Reference ->
crossQuery ->
Query Parser Output Tags -> Exact Search Tag ]
Exact Search Tag
This tag specifies an exact phrase to search for. This tag has the form:
<exact {field = "FieldName"}
{maxSnippets = "SnippetsToOutput"}
{boost = "BoostValue"}>
Term | Clause
Term | Clause
…
{OptionalSectionTypeQuery}
</exact>
where
field="FieldName" |
is an optional attribute that identifies which field in the index to search. Normally, this attribute is set to the name of a meta field such as author or subject. It may not be set to text. It should be mentioned that the field name specified by a <exact> tag must match the field name set by any tags that contain it. Otherwise, an error will be generated. If no parent tags specify a field name, any field name can be used by the <exact> tag. Similarly, any tags within an <exact> tag must either specify the same field name as the phrase, or specify no field name at all. Otherwise, an error will be generated. (Note: Allowing nested copies of the field attribute doesn't serve a purpose other than to make it easier to write docReqParser.xsl stylesheets in a uniform way. Effectively, the outermost field value is always used.) |
maxSnippets="SnippetsToOutput" |
is an optional attribute that identifies the number of snippets to pass on to the Result Formatter stylesheet for display. A snippet is defined as the matching text found in a document for a particular query, along with some additional text around it for context. The amount of context displayed for each match is defined by the maxContext attribute. If not specified this attribute defaults to 3, meaning snippets for the top three matches for a document are returned. Also, this attribute can be set to -1, meaning all the snippets for a document are returned. As with the field attribute, any maxSnippets value set by the <exact> tag must match the value set by any tags that contain it. Otherwise, an error will be generated. If no parent tags set a maxSnippets value, then any value may be specified by the <exact> tag. Similarly, any tags within a <exact> tag must either specify the same field name as the phrase, or specify no field name at all. Otherwise, an error will be generated. (Note: Allowing nested copies of the maxSnippets attribute doesn't serve a purpose other than to make it easier to write docReqParser.xsl stylesheets in a uniform way. Effectively, the outermost maxSnippets value is always used.) |
boost="BoostValue" |
is an optional attribute that specifies a relevance boost multiplier for this phrase in the query. Boost values higher than 1.0 increase the relevance of a phrase, while boost values between 0.0 and 1.0 decrease the relevance of a phrase. Boost values less than zero will generate an error. Note that boost values multiply. That is, if tags within an <exact> tag have boost attributes, their individual boost values will be multiplied by the boost set for the containing <exact> tag. |
Within the exact tag, Term is a
term tag, and Clause is a
phrase,
and,
or,
orNear,
near,
range,
resultData, or
not tag.
Note that text will only match a exact query if all the terms in the exact tag appear in the document in same order, with no other intervening words. In addition, the match must begin at the start of the field and end at the end of the field (in other words, it must match the entire field.)
For example, an exact search for "man on the moon" would not match field contents"put a man on the moon", nor would it match "man on the moon base". Only a field whose contents are exactly the string "man on the moon" (and nothing else) will match.
Note that "exact"-ness refers only to the lack of other terms before and after the match; the normal rules for upper/lower case insensitivity, and accent/plural mapping still apply. So "man on the moon" will still match "Men on the MOON".
If the field is "text", a
Section Type sub-query may optionally appear, restricting this query to particular sections of a document based on section types added by the
Pre-Filter stylesheet at index time.