Returns the final tokenization result after applying a given word breaker, thesaurus, and stoplist combination to a query string input. The tokenization result is equivalent to the output of the Full-Text Engine for the specified query string.
sys.dm_fts_parser is a dynamic management function.
The hexadecimal representation of a given keyword returned by a word breaker. This representation is used to store the keyword in the full-text index. This value is not human-readable, but it is useful for relating a given keyword to output returned by other dynamic management views that return the content of a full-text index, such as sys.dm_fts_index_keywords and sys.dm_fts_index_keywords_by_document.
OxFF represents the special character that indicates the end of a file or dataset.
Contain an integer value that is useful for differentiating the logical group from which a given term was generated. For example, 'Server AND DB OR FORMSOF(THESAURUS, DB)"' produces the following group_id values in English:
Contains an integer value that is useful for differentiating the cases in which alternative forms of compound words, such as full-text, are issued by the word breaker. Sometimes, with presence of compound words ('multi-million'), alternative forms are issued by the word breaker. These alternative forms (phrases) need to be differentiated sometimes.
For example, 'multi-million' produces the following phrase_id values in English:
Indicates the order of each term in the parsing result. For example, for the phrase "SQL Server query processor" occurrence would contain the following occurrence values for the terms in the phrase, in English:
Contains information about the characteristics of the term that is being issued by the word breaker, one of:
End of Sentence
End of paragraph
End of Chapter
Contains the human-readable form of the keyword. As with the functions designed to access the content of the full-text index, this displayed term might not be identical to the original term due to the denormalization limitation. However, it should be precise enough to help you identify it from the original input.
Contains information about the nature of the expansion of a given term, one of:
0 =Single word case
For example, consider a case in which the thesaurus defines run as an expansion of jog:
The term FORMSOF (FREETEXT, run) generates the following output:
run with expansion_type=0
runs with expansion_type=2
running with expansion_type=2
ran with expansion_type=2
jog with expansion_type=4
The term or phrase from which a given term was generated or parsed. For example, a query on the '"word breakers" AND stemmers' produces the following source_term values in English:
Using Unicode for Parsing Special Characters
When you parse a query string, sys.dm_fts_parser uses the collation of the database to which you are connected, unless you specify the query string as Unicode. Therefore, for a non-Unicode string that contains special characters, such as ü or ç, the output might be unexpected, depending on the collation of the database. To process a query string independently of the database collation, prefix the string with N, that is, N'query_string'.
For more information, see "C. Displaying the Output of a String that Contains Special Characters," later in this topic.
When to Use sys.dm_fts_parser
sys.dm_fts_parser can be very powerful for debugging purposes. Some major usage scenarios include:
To understand how a given word breaker treats a given input
When a query returns unexpected results, a likely cause is the way that the word breaker is parsing and breaking the data. By using sys.dm_fts_parser, you discover the result that a word breaker passes to the full-text index. In addition, you can see which terms are stopwords, which are not searched in the full-text index. Whether a term is a stopword for a given language depends on whether it is in the stoplist specified by the stoplist_id value that is declared in the function.
Note as well the accent sensitivity flag, which will allow the user to see how the word breaker will parse the input having in mind its accent sensitivity information.
To understand how the stemmer works on a given input
You can find out how the word breaker and the stemmer parse a query term and its stemming forms, by specifying a CONTAINS or CONTAINSTABLE query containing the following FORMSOF clause:
FORMSOF( INFLECTIONAL, query_term )
The results tell you what terms are being passed to the full-text index.
To understand how the thesaurus expands or replaces all or part of the input
You can also specify:
FORMSOF( THESAURUS, query_term )
The results of this query show how the word breaker and thesaurus interact for the query term. you can see the expansion or replacements from the thesaurus and identify the resulting query that is actually being issued against the full-text index.
Note that if the user issues:
FORMSOF( FREETEXT, query_term )
The inflectional and Thesaurus capabilities will take place automatically.
In addition to the preceding usage scenarios, sys.dm_fts_parser can help significantly to understand and troubleshoot many other issues with full-text query.
A. Displaying the output of a given word breaker for a keyword or phrase
The following example returns the output from using the English word breaker, whose LCID is 1033, and no stoplist on the following query string:
The Microsoft business analysis
Accent sensitivity is disabled.
SELECT * FROM sys.dm_fts_parser (' "The Microsoft business analysis" ', 1033, 0, 0)
B. Displaying the output of a given word breaker in the context of stoplist filtering
The following example returns the output from using the English word breaker, whose LCID is 1033, and an English stoplist, whose ID is 77, on the following query string:
"The Microsoft business analysis" OR "MS revenue"
Accent sensitivity is disabled.
SELECT * FROM sys.dm_fts_parser (' "The Microsoft business analysis" OR " MS revenue" ', 1033, 77, 0)
C. Displaying the Output of a String that Contains Special Characters
The following example uses Unicode to parse the following French string:
The example specifies the LCID for the French language, 1036, and the ID of a user-defined stoplist, 5. Accent sensitivity is enabled.
SELECT * FROM sys.dm_fts_parser(N'français', 1036, 5, 1);