[ You are here:
XTF ->
Tag Reference ->
crossQuery ->
Query Parser Output Tags -> Term Search Tag ]
Term Search Tag
This tag specifies a single word to search for. This tag has the form:
<term {field = "FieldName"}
{maxSnippets = "SnippetsToOutput"}
{boost = "BoostValue"}>
WordToFind
{OptionalSectionTypeQuery}
</term>
where
field="FieldName" |
is an optional attribute that identifies which field in the index to search. Often this attribute is set to text to indicate that the main text of the document should be searched. It can also be set to the name of a meta field such as author or subject. It should be mentioned that the field name specified by a <term> tag must match the field name set by any tags that contain it. Otherwise, an error will be generated. |
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, the maxSnippets specified by a <term> tag must match the value set by any tags that contain it. Otherwise, an error will be generated. |
boost="BoostValue" |
is an optional attribute that specifies a relevance boost multiplier for this term in the query. Boost values higher than 1.0 increase the relevance of a term, while boost values between 0.0 and 1.0 decrease the relevance of a term. Boost values less than zero will generate an error. |
Note that aside from letters and numbers, only a few select symbols may appear in WordToFind (e.g., apostrophes, periods as part of decimal numbers, etc.) If any other symbols appear in the word to find, no matches will be found in the index. This is because the indexer removes all other types symbols from a term before indexing it. For a complete list of symbols that may appear in a term, see the
XTF Under the Hood guide.
Also, the term tag is case-insensitive, so matches with capitalization different from that given in WordToFind may appear in the resulting list of matches.
(Note: Any non-leading or trailing whitespace characters in WordToFind (i.e, space, tab, carriage-return, linefeed, etc.) will produce unpredictable search results.)
If the field is
"text", a
Section Type sub-query may optionally appear, restricting this term query to particular sections of a document based on section types added by the
Pre-Filter stylesheet at index time.