Working with Full-Text Search
On this page
Full-text search allows you to search for words or phrases in a large body of text efficiently.fuzzy
and performed over the text types CHAR, VARCHAR, TEXT, and LONGTEXT.
Overview
Full-text indexes are only supported on columnstore tables.CREATE TABLE query using the FULLTEXT index type.
CREATE TABLE <table_name> (FULLTEXT [<fts_index_name>] (<fts_col>))
Content in columns that are full-text indexed can be searched using the MATCH function.MATCH clause applies to only one table.MATCH clauses.
If an index name was not designated when creating the table, the full-text index key_ must be used when dropping the index.key_ is displayed when the SHOW INDEXES FROM <table_ command is executed.
Full-text search may not be used inside a CTE (WITH (Common Table Expressions)) because the CTE produces a dynamic table which does not have a full-text index.
During indexing, column values are split into tokens, which are turned into indexed terms.
Note
New inserts and updates into columnstore tables may initially be stored in a hidden rowstore table before being flushed to a segment file.
In that case, the full-text index in the columnstore will be updated asynchronously for new inserts and updates.OPTIMIZE TABLE <table_ command.
Since an index is created for each segment file, the distribution of words within the segment may affect the score of full-text queries, especially when the segments have very few rows and the columns have very few words.
Relevancy Score
The relevancy score of an expression in a MATCH statement denotes the ranking of the expression based on the following factors:
-
Number of times an expression appears in a column.
More occurrences of an expression in the matched column(s) increases its relevancy score. -
Rarity of the expression.
Rare words have a higher relevancy score than commonly used words. -
The length of the column containing the expression.
A column with a short expression has a higher relevancy score than a column with a long expression.
Index Repair
Full-text index creation failure is rare.ER_.OPTIMIZE TABLE <tablename> FIX_.
Related Topics
-
Working with Vector Data- Allows for semantic searching, which is searching based on meanings, not keywords.
-
Training: Full-Text Index and Search
Last modified: September 26, 2025