MySQL 9.1.0
Source Code Documentation
fts0fts.h File Reference

Full text search header file. More...

#include "ha_prototypes.h"
#include "data0type.h"
#include "data0types.h"
#include "dict0types.h"
#include "ft_global.h"
#include "hash0hash.h"
#include "mem0mem.h"
#include "mysql/plugin_ftparser.h"
#include "que0types.h"
#include "rem0types.h"
#include "row0types.h"
#include "trx0types.h"
#include "ut0rbt.h"
#include "ut0vec.h"
#include "ut0wqueue.h"

Go to the source code of this file.

Classes

struct  aux_name_vec_t
 Structure to manage FTS AUX table name and MDL during its drop. More...
 
struct  fts_trx_t
 Information about changes in a single transaction affecting the FTS system. More...
 
struct  fts_savepoint_t
 Information required for transaction savepoint handling. More...
 
struct  fts_trx_table_t
 Information about changed rows in a transaction for a single table. More...
 
struct  fts_trx_row_t
 Information about one changed row in a transaction. More...
 
struct  fts_doc_ids_t
 List of document ids that were added during a transaction. More...
 
struct  fts_string_t
 An UTF-16 ro UTF-8 string. More...
 
struct  fts_ranking_t
 Query ranked doc ids. More...
 
struct  fts_result_t
 Query result. More...
 
struct  fts_table_t
 This is used to generate the FTS auxiliary table name, we need the table id and the index id to generate the column specific FTS auxiliary table name. More...
 
class  fts_t
 The state of the FTS sub system. More...
 
struct  fts_aux_table_t
 For storing table info when checking for orphaned tables. More...
 

Macros

#define FTS_NULL_DOC_ID   0
 "NULL" value of a document id. More...
 
#define FTS_DOC_ID_COL_NAME   "FTS_DOC_ID"
 FTS hidden column that is used to map to and from the row. More...
 
#define FTS_DOC_ID_INDEX_NAME   "FTS_DOC_ID_INDEX"
 The name of the index created by FTS. More...
 
#define FTS_DOC_ID_INDEX_NAME_LEN   16
 
#define FTS_DOC_ID_LEN   8
 Doc ID is a 8 byte value. More...
 
#define FTS_NUM_FIELDS_SORT   3
 The number of fields to sort when we build FT index with FIC. More...
 
#define MAX_DOC_ID_OPT_VAL   1073741824
 Maximum number of rows in a table, smaller than which, we will optimize using a 4 byte Doc ID for FIC merge sort to reduce sort size. More...
 
#define FTS_DOC_ID_FORMAT   IB_ID_FMT
 doc_id_t printf format More...
 
#define fts_write_doc_id(d, s)   mach_write_to_8(d, s)
 Convert document id to the InnoDB (BIG ENDIAN) storage format. More...
 
#define fts_read_doc_id(s)   mach_read_from_8(s)
 Read a document id to internal format. More...
 
#define fts_bind_doc_id(i, n, v)   pars_info_bind_int8_literal(i, n, v)
 Bind the doc id to a variable. More...
 
#define FTS_NL   0
 Defines for FTS query mode, they have the same values as those defined in mysql file ft_global.h. More...
 
#define FTS_BOOL   1
 
#define FTS_SORTED   2
 
#define FTS_EXPAND   4
 
#define FTS_NO_RANKING   8
 
#define FTS_PROXIMITY   16
 
#define FTS_PHRASE   32
 
#define FTS_OPT_RANKING   64
 
#define FTS_INDEX_TABLE_IND_NAME   "FTS_INDEX_TABLE_IND"
 
#define FTS_COMMON_TABLE_IND_NAME   "FTS_COMMON_TABLE_IND"
 
#define FTS_OPTIMIZE_THRESHOLD   10000000
 Threshold where our optimize thread automatically kicks in. More...
 
#define FTS_DOC_ID_MAX_STEP   65535
 Threshold to avoid exhausting of doc ids. More...
 
#define FTS_MAX_WORD_LEN   HA_FT_MAXBYTELEN
 Maximum possible Fulltext word length. More...
 
#define FTS_MAX_WORD_LEN_IN_CHAR   HA_FT_MAXCHARLEN
 Maximum possible Fulltext word length (in characters) More...
 
#define FTS_DELETED_TABLE_NUM_COLS   1
 Number of columns in FTS AUX Tables. More...
 
#define FTS_CONFIG_TABLE_NUM_COLS   2
 
#define FTS_AUX_INDEX_TABLE_NUM_COLS   5
 
#define FTS_DELETED_TABLE_COL_LEN   8
 DELETED_TABLE(doc_id BIGINT UNSIGNED) More...
 
#define FTS_CONFIG_TABLE_KEY_COL_LEN   50
 CONFIG_TABLE(key CHAR(50), value CHAR(200)) More...
 
#define FTS_CONFIG_TABLE_VALUE_COL_LEN   200
 
#define FTS_INDEX_WORD_LEN   FTS_MAX_WORD_LEN
 
#define FTS_INDEX_FIRST_DOC_ID_LEN   8
 
#define FTS_INDEX_LAST_DOC_ID_LEN   8
 
#define FTS_INDEX_DOC_COUNT_LEN   4
 
#define FTS_INDEX_ILIST_LEN   0
 
#define FTS_MAX_NESTED_EXP   31
 
#define FTS_INIT_FTS_TABLE(fts_table, m_suffix, m_type, m_table)
 Initialize the "fts_table" for internal query into FTS auxiliary tables. More...
 
#define FTS_INIT_INDEX_TABLE(fts_table, m_suffix, m_type, m_index)
 
#define STOPWORD_NOT_INIT   0x1
 status bits for fts_stopword_t status field. More...
 
#define STOPWORD_OFF   0x2
 
#define STOPWORD_FROM_DEFAULT   0x4
 
#define STOPWORD_USER_TABLE   0x8
 
#define fts_que_graph_free(graph)
 

Typedefs

typedef uint64_t doc_id_t
 Document id type. More...
 
typedef float fts_rank_t
 FTS rank type, which will be between 0 . More...
 
typedef unsigned short ib_uc_t
 Since MySQL's character set support for Unicode is woefully inadequate (it supports basic operations like isalpha etc. More...
 
typedef enum fts_status fts_status_t
 

Enumerations

enum  fts_row_state {
  FTS_INSERT = 0 , FTS_MODIFY , FTS_DELETE , FTS_NOTHING ,
  FTS_INVALID
}
 Type of a row during a transaction. More...
 
enum  fts_table_type_t { FTS_INDEX_TABLE , FTS_COMMON_TABLE , FTS_OBSOLETED_TABLE }
 The FTS table types. More...
 
enum  fts_status { BG_THREAD_STOP = 1 , BG_THREAD_READY = 2 , ADD_THREAD_STARTED = 4 , ADDED_TABLE_SYNCED = 8 }
 

Functions

fts_cache_tfts_cache_create (dict_table_t *table)
 Create a FTS cache. More...
 
fts_index_cache_tfts_cache_index_cache_create (dict_table_t *table, dict_index_t *index)
 Create a FTS index cache. More...
 
void fts_cache_index_cache_remove (dict_table_t *table, dict_index_t *index)
 Remove a FTS index cache. More...
 
dberr_t fts_get_next_doc_id (const dict_table_t *table, doc_id_t *doc_id)
 Get the next available document id. More...
 
void fts_update_next_doc_id (trx_t *trx, const dict_table_t *table, const char *table_name, doc_id_t doc_id)
 Update the next and last Doc ID in the CONFIG table to be the input "doc_id" value (+ 1). More...
 
dberr_t fts_create_doc_id (dict_table_t *table, dtuple_t *row, mem_heap_t *heap)
 Create a new document id. More...
 
fts_doc_ids_tfts_doc_ids_create (void)
 Create a new fts_doc_ids_t. More...
 
void fts_doc_ids_free (fts_doc_ids_t *doc_ids)
 Free a fts_doc_ids_t. More...
 
void fts_trx_add_op (trx_t *trx, dict_table_t *table, doc_id_t doc_id, fts_row_state state, ib_vector_t *fts_indexes)
 Notify the FTS system about an operation on an FTS-indexed table. More...
 
void fts_trx_free (fts_trx_t *fts_trx)
 Free an FTS trx. More...
 
bool fts_check_common_tables_exist (const dict_table_t *table)
 Check if common tables already exist. More...
 
dberr_t fts_create_common_tables (trx_t *trx, const dict_table_t *table, const char *name, bool skip_doc_id_index)
 Creates the common auxiliary tables needed for supporting an FTS index on the given table. More...
 
dberr_t fts_create_index_tables (trx_t *trx, dict_index_t *index)
 Creates the column specific ancillary tables needed for supporting an FTS index on the given table. More...
 
dberr_t fts_create_index_tables_low (trx_t *trx, dict_index_t *index, const char *table_name, table_id_t table_id)
 Create auxiliary index tables for an FTS index. More...
 
void fts_add_doc_id_column (dict_table_t *table, mem_heap_t *heap)
 Add the FTS document id hidden column. More...
 
dberr_t fts_drop_tables (trx_t *trx, dict_table_t *table, aux_name_vec_t *aux_vec)
 Drops the ancillary tables needed for supporting an FTS index on a given table. More...
 
dberr_t fts_lock_all_aux_tables (THD *thd, dict_table_t *table)
 Lock all FTS AUX tables (for dropping table) More...
 
bool fts_drop_dd_tables (const aux_name_vec_t *aux_vec, bool file_per_table)
 Drop FTS AUX table DD table objects in vector. More...
 
void fts_free_aux_names (aux_name_vec_t *aux_vec)
 Free FTS AUX table names in vector. More...
 
dberr_t fts_commit (trx_t *trx)
 The given transaction is about to be committed; do whatever is necessary from the FTS system's POV. More...
 
dberr_t fts_query (trx_t *trx, dict_index_t *index, uint flags, const byte *query_str, ulint query_len, fts_result_t **result, ulonglong limit)
 FTS Query entry point. More...
 
float fts_retrieve_ranking (fts_result_t *result, doc_id_t doc_id)
 Retrieve the FTS Relevance Ranking result for doc with doc_id. More...
 
void fts_query_sort_result_on_rank (fts_result_t *result)
 FTS Query sort result, returned by fts_query() on fts_ranking_t::rank. More...
 
void fts_query_free_result (fts_result_t *result)
 FTS Query free result, returned by fts_query(). More...
 
doc_id_t fts_get_doc_id_from_row (dict_table_t *table, dtuple_t *row)
 Extract the doc id from the FTS hidden column. More...
 
doc_id_t fts_get_doc_id_from_rec (dict_table_t *table, const rec_t *rec, const dict_index_t *index, mem_heap_t *heap)
 Extract the doc id from the record that belongs to index. More...
 
doc_id_t fts_update_doc_id (dict_table_t *table, upd_field_t *ufield, doc_id_t *next_doc_id)
 Add new fts doc id to the update vector. More...
 
void fts_startup (void)
 FTS initialize. More...
 
fts_tfts_create (dict_table_t *table)
 Create an instance of fts_t. More...
 
void fts_free (dict_table_t *table)
 Free the FTS resources. More...
 
dberr_t fts_optimize_table (dict_table_t *table)
 Run OPTIMIZE on the given table. More...
 
void fts_optimize_init (void)
 Startup the optimize thread and create the work queue. More...
 
dberr_t fts_drop_index_tables (trx_t *trx, dict_index_t *index, aux_name_vec_t *aux_vec)
 Since we do a horizontal split on the index table, we need to drop all the split tables. More...
 
dberr_t fts_empty_common_tables (trx_t *trx, dict_table_t *table)
 Empty all common talbes. More...
 
void fts_optimize_remove_table (dict_table_t *table)
 Remove the table from the OPTIMIZER's list. More...
 
void fts_optimize_shutdown ()
 Shutdown fts optimize thread. More...
 
void fts_optimize_request_sync_table (dict_table_t *table)
 Send sync fts cache for the table. More...
 
void fts_savepoint_take (fts_trx_t *fts_trx, const char *name)
 Take a FTS savepoint. More...
 
void fts_savepoint_laststmt_refresh (trx_t *trx)
 Refresh last statement savepoint. More...
 
void fts_savepoint_release (trx_t *trx, const char *name)
 Release the savepoint data identified by name. More...
 
void fts_cache_clear (fts_cache_t *cache)
 Clear cache. More...
 
void fts_cache_init (fts_cache_t *cache)
 Initialize things in cache. More...
 
void fts_savepoint_rollback (trx_t *trx, const char *name)
 Rollback to and including savepoint identified by name. More...
 
void fts_savepoint_rollback_last_stmt (trx_t *trx)
 Rollback to and including savepoint identified by name. More...
 
char * fts_get_parent_table_name (const char *aux_table_name, ulint aux_table_len)
 
dberr_t fts_sync_table (dict_table_t *table, bool unlock_cache, bool wait, bool has_dict)
 Run SYNC on the table, i.e., write out data from the cache to the FTS auxiliary INDEX table and clear the cache at the end. More...
 
CHARSET_INFOfts_index_get_charset (dict_index_t *index)
 Create an FTS index cache. More...
 
doc_id_t fts_init_doc_id (const dict_table_t *table)
 Get the initial Doc ID by consulting the CONFIG table. More...
 
int innobase_fts_text_cmp (const void *cs, const void *p1, const void *p2)
 Compare two character string according to their charset. More...
 
size_t innobase_fts_casedn_str (CHARSET_INFO *cs, char *src, size_t src_len, char *dst, size_t dst_len)
 Makes all characters in a string lower case. More...
 
int innobase_fts_text_cmp_prefix (const void *cs, const void *p1, const void *p2)
 Compare two character string according to their charset. More...
 
ulint innobase_mysql_fts_get_token (CHARSET_INFO *charset, const byte *start, const byte *end, fts_string_t *token)
 Get the next token from the given string and store it in *token. More...
 
bool innobase_fts_drop_dd_table (const char *name, bool file_per_table)
 Drop dd table & tablespace for fts aux table. More...
 
ulint fts_get_token_size (const CHARSET_INFO *cs, const char *token, ulint len)
 Get token char size by charset. More...
 
int fts_tokenize_document_internal (MYSQL_FTPARSER_PARAM *param, char *doc, int len)
 FULLTEXT tokenizer internal in MYSQL_FTPARSER_SIMPLE_MODE. More...
 
ulint fts_get_rows_count (fts_table_t *fts_table)
 Fetch COUNT(*) from specified table. More...
 
doc_id_t fts_get_max_doc_id (dict_table_t *table)
 Get maximum Doc ID in a table if index "FTS_DOC_ID_INDEX" exists. More...
 
CHARSET_INFOfts_valid_stopword_table (const char *stopword_table_name)
 Check whether user supplied stopword table exists and is of the right format. More...
 
bool fts_load_stopword (const dict_table_t *table, trx_t *trx, const char *global_stopword_table, const char *session_stopword_table, bool stopword_is_on, bool reload)
 This function loads specified stopword into FTS cache. More...
 
dberr_t fts_table_fetch_doc_ids (trx_t *trx, fts_table_t *fts_table, fts_doc_ids_t *doc_ids)
 Read the rows from the FTS index. More...
 
bool fts_init_index (dict_table_t *table, bool has_cache_lock)
 This function brings FTS index in sync when FTS index is first used. More...
 
void fts_add_index (dict_index_t *index, dict_table_t *table)
 Add a newly create index in FTS cache. More...
 
dberr_t fts_drop_index (dict_table_t *table, dict_index_t *index, trx_t *trx, aux_name_vec_t *aux_vec, bool adding_another=false)
 Drop auxiliary tables related to an FTS index. More...
 
dberr_t fts_rename_aux_tables (dict_table_t *table, const char *new_name, trx_t *trx, bool replay)
 Rename auxiliary tables for all fts index for a table. More...
 
bool fts_check_cached_index (dict_table_t *table)
 Check indexes in the fts->indexes is also present in index cache and table->indexes list. More...
 
void fts_add_doc_from_tuple (fts_trx_table_t *ftt, doc_id_t doc_id, const dtuple_t *tuple)
 Fetch the document from tuple, tokenize the text data and insert the text data into fts auxiliary table and its cache. More...
 
fts_trx_tfts_trx_create (trx_t *trx)
 Create an FTS trx. More...
 
bool fts_is_aux_table_name (fts_aux_table_t *table, const char *name, ulint len)
 Check if a table is an FTS auxiliary table name. More...
 
void fts_freeze_aux_tables (const dict_table_t *table)
 Freeze all auiliary tables to be not evictable if exist, with dict_mutex held. More...
 
void fts_detach_aux_tables (const dict_table_t *table, bool dict_locked)
 Allow all the auxiliary tables of specified base table to be evictable if they exist, if not exist just ignore. More...
 
bool fts_create_common_dd_tables (const dict_table_t *table)
 Update DD system table for auxiliary common tables for an FTS index. More...
 
dberr_t fts_create_index_dd_tables (dict_table_t *table)
 Check if a table has FTS index needs to have its auxiliary index tables' metadata updated in DD. More...
 
dberr_t fts_upgrade_aux_tables (dict_table_t *table)
 Upgrade FTS AUX Tables. More...
 
dberr_t fts_upgrade_rename (const dict_table_t *table, bool rollback)
 Rename FTS AUX tablespace name from 8.0 format to 5.7 format. More...
 

Variables

constexpr size_t FTS_NUM_AUX_INDEX = 6
 The number of FTS index partitions for a fulltext index. More...
 
constexpr size_t FTS_NUM_AUX_COMMON = 5
 The number of FTS AUX common table for a fulltext index. More...
 
const char * FTS_PREFIX
 FTS auxiliary table prefix that are common to all FT indexes. More...
 
const char * FTS_SUFFIX_BEING_DELETED
 
const char * FTS_SUFFIX_BEING_DELETED_CACHE
 
const char * FTS_SUFFIX_CONFIG
 
const char * FTS_SUFFIX_DELETED
 
const char * FTS_SUFFIX_DELETED_CACHE
 
const char * FTS_PREFIX_5_7
 FTS auxiliary table prefix that are common to all FT indexes. More...
 
const char * FTS_SUFFIX_CONFIG_5_7
 
ulong fts_num_word_optimize
 Variable specifying the number of word to optimize for each optimize table call. More...
 
bool fts_enable_diag_print
 Variable specifying whether we do additional FTS diagnostic printout in the log. More...
 
const char * fts_default_stopword []
 InnoDB default stopword list: There are different versions of stopwords, the stop words listed below comes from "Google Stopword" list. More...
 
ulong fts_max_cache_size
 Variable specifying the maximum FTS cache size for each table. More...
 
ulong fts_max_total_cache_size
 Variable specifying the total memory allocated for FTS cache. More...
 
ulong fts_result_cache_limit
 Variable specifying the FTS result cache limit for each query. More...
 
ulong fts_max_token_size
 Variable specifying the maximum FTS max token size. More...
 
ulong fts_min_token_size
 Variable specifying the minimum FTS max token size. More...
 
bool fts_need_sync
 Whether the total memory used for FTS cache is exhausted, and we will need a sync to free some memory. More...
 
char * fts_internal_tbl_name
 Variable specifying the table that has Fulltext index to display its content through information schema table. More...
 

Detailed Description

Full text search header file.

Created 2011/09/02 Sunny Bains

Macro Definition Documentation

◆ FTS_AUX_INDEX_TABLE_NUM_COLS

#define FTS_AUX_INDEX_TABLE_NUM_COLS   5

◆ fts_bind_doc_id

#define fts_bind_doc_id (   i,
  n,
 
)    pars_info_bind_int8_literal(i, n, v)

Bind the doc id to a variable.

◆ FTS_BOOL

#define FTS_BOOL   1

◆ FTS_COMMON_TABLE_IND_NAME

#define FTS_COMMON_TABLE_IND_NAME   "FTS_COMMON_TABLE_IND"

◆ FTS_CONFIG_TABLE_KEY_COL_LEN

#define FTS_CONFIG_TABLE_KEY_COL_LEN   50

CONFIG_TABLE(key CHAR(50), value CHAR(200))

◆ FTS_CONFIG_TABLE_NUM_COLS

#define FTS_CONFIG_TABLE_NUM_COLS   2

◆ FTS_CONFIG_TABLE_VALUE_COL_LEN

#define FTS_CONFIG_TABLE_VALUE_COL_LEN   200

◆ FTS_DELETED_TABLE_COL_LEN

#define FTS_DELETED_TABLE_COL_LEN   8

DELETED_TABLE(doc_id BIGINT UNSIGNED)

◆ FTS_DELETED_TABLE_NUM_COLS

#define FTS_DELETED_TABLE_NUM_COLS   1

Number of columns in FTS AUX Tables.

◆ FTS_DOC_ID_COL_NAME

#define FTS_DOC_ID_COL_NAME   "FTS_DOC_ID"

FTS hidden column that is used to map to and from the row.

◆ FTS_DOC_ID_FORMAT

#define FTS_DOC_ID_FORMAT   IB_ID_FMT

doc_id_t printf format

◆ FTS_DOC_ID_INDEX_NAME

#define FTS_DOC_ID_INDEX_NAME   "FTS_DOC_ID_INDEX"

The name of the index created by FTS.

◆ FTS_DOC_ID_INDEX_NAME_LEN

#define FTS_DOC_ID_INDEX_NAME_LEN   16

◆ FTS_DOC_ID_LEN

#define FTS_DOC_ID_LEN   8

Doc ID is a 8 byte value.

◆ FTS_DOC_ID_MAX_STEP

#define FTS_DOC_ID_MAX_STEP   65535

Threshold to avoid exhausting of doc ids.

Consecutive doc id difference should not exceed FTS_DOC_ID_MAX_STEP

◆ FTS_EXPAND

#define FTS_EXPAND   4

◆ FTS_INDEX_DOC_COUNT_LEN

#define FTS_INDEX_DOC_COUNT_LEN   4

◆ FTS_INDEX_FIRST_DOC_ID_LEN

#define FTS_INDEX_FIRST_DOC_ID_LEN   8

◆ FTS_INDEX_ILIST_LEN

#define FTS_INDEX_ILIST_LEN   0

◆ FTS_INDEX_LAST_DOC_ID_LEN

#define FTS_INDEX_LAST_DOC_ID_LEN   8

◆ FTS_INDEX_TABLE_IND_NAME

#define FTS_INDEX_TABLE_IND_NAME   "FTS_INDEX_TABLE_IND"

◆ FTS_INDEX_WORD_LEN

#define FTS_INDEX_WORD_LEN   FTS_MAX_WORD_LEN

◆ FTS_INIT_FTS_TABLE

#define FTS_INIT_FTS_TABLE (   fts_table,
  m_suffix,
  m_type,
  m_table 
)
Value:
do { \
(fts_table)->suffix = m_suffix; \
(fts_table)->type = m_type; \
(fts_table)->table_id = m_table->id; \
(fts_table)->parent = m_table->name.m_name; \
(fts_table)->table = m_table; \
} while (0);
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
required string type
Definition: replication_group_member_actions.proto:34

Initialize the "fts_table" for internal query into FTS auxiliary tables.

◆ FTS_INIT_INDEX_TABLE

#define FTS_INIT_INDEX_TABLE (   fts_table,
  m_suffix,
  m_type,
  m_index 
)
Value:
do { \
(fts_table)->suffix = m_suffix; \
(fts_table)->type = m_type; \
(fts_table)->table_id = m_index->table->id; \
(fts_table)->parent = m_index->table->name.m_name; \
(fts_table)->table = m_index->table; \
(fts_table)->index_id = m_index->id; \
} while (0);

◆ FTS_MAX_NESTED_EXP

#define FTS_MAX_NESTED_EXP   31

◆ FTS_MAX_WORD_LEN

#define FTS_MAX_WORD_LEN   HA_FT_MAXBYTELEN

Maximum possible Fulltext word length.

◆ FTS_MAX_WORD_LEN_IN_CHAR

#define FTS_MAX_WORD_LEN_IN_CHAR   HA_FT_MAXCHARLEN

Maximum possible Fulltext word length (in characters)

◆ FTS_NL

#define FTS_NL   0

Defines for FTS query mode, they have the same values as those defined in mysql file ft_global.h.

◆ FTS_NO_RANKING

#define FTS_NO_RANKING   8

◆ FTS_NULL_DOC_ID

#define FTS_NULL_DOC_ID   0

"NULL" value of a document id.

◆ FTS_NUM_FIELDS_SORT

#define FTS_NUM_FIELDS_SORT   3

The number of fields to sort when we build FT index with FIC.

Three fields are sort: (word, doc_id, position)

◆ FTS_OPT_RANKING

#define FTS_OPT_RANKING   64

◆ FTS_OPTIMIZE_THRESHOLD

#define FTS_OPTIMIZE_THRESHOLD   10000000

Threshold where our optimize thread automatically kicks in.

◆ FTS_PHRASE

#define FTS_PHRASE   32

◆ FTS_PROXIMITY

#define FTS_PROXIMITY   16

◆ fts_que_graph_free

#define fts_que_graph_free (   graph)
Value:
do { \
que_graph_free(graph); \
} while (0)

◆ fts_read_doc_id

#define fts_read_doc_id (   s)    mach_read_from_8(s)

Read a document id to internal format.

◆ FTS_SORTED

#define FTS_SORTED   2

◆ fts_write_doc_id

#define fts_write_doc_id (   d,
 
)    mach_write_to_8(d, s)

Convert document id to the InnoDB (BIG ENDIAN) storage format.

◆ MAX_DOC_ID_OPT_VAL

#define MAX_DOC_ID_OPT_VAL   1073741824

Maximum number of rows in a table, smaller than which, we will optimize using a 4 byte Doc ID for FIC merge sort to reduce sort size.

◆ STOPWORD_FROM_DEFAULT

#define STOPWORD_FROM_DEFAULT   0x4

◆ STOPWORD_NOT_INIT

#define STOPWORD_NOT_INIT   0x1

status bits for fts_stopword_t status field.

◆ STOPWORD_OFF

#define STOPWORD_OFF   0x2

◆ STOPWORD_USER_TABLE

#define STOPWORD_USER_TABLE   0x8

Typedef Documentation

◆ doc_id_t

typedef uint64_t doc_id_t

Document id type.

◆ fts_rank_t

typedef float fts_rank_t

FTS rank type, which will be between 0 .

. 1 inclusive

◆ fts_status_t

typedef enum fts_status fts_status_t

◆ ib_uc_t

typedef unsigned short ib_uc_t

Since MySQL's character set support for Unicode is woefully inadequate (it supports basic operations like isalpha etc.

only for 8-bit characters), we have to implement our own. We use UTF-16 without surrogate processing as our in-memory format. This typedef is a single such character.

Enumeration Type Documentation

◆ fts_row_state

Type of a row during a transaction.

FTS_NOTHING means the row can be forgotten from the FTS system's POV, FTS_INVALID is an internal value used to mark invalid states.

NOTE: Do not change the order or value of these, fts_trx_row_get_new_state depends on them being exactly as they are.

Enumerator
FTS_INSERT 
FTS_MODIFY 
FTS_DELETE 
FTS_NOTHING 
FTS_INVALID 

◆ fts_status

enum fts_status
Enumerator
BG_THREAD_STOP 

true if the FTS background thread has finished reading the ADDED table, meaning more items can be added to the table.

BG_THREAD_READY 

true if the FTS background thread is ready

ADD_THREAD_STARTED 

true if the FTS add thread has started

ADDED_TABLE_SYNCED 

true if the ADDED table record is sync-ed after crash recovery

◆ fts_table_type_t

The FTS table types.

Enumerator
FTS_INDEX_TABLE 

FTS auxiliary table that is specific to a particular FTS index on a table.

FTS_COMMON_TABLE 

FTS auxiliary table that is common for all FTS index on a table.

FTS_OBSOLETED_TABLE 

FTS obsoleted tables like DOC_ID, ADDED, STOPWORDS.

Function Documentation

◆ fts_add_doc_from_tuple()

void fts_add_doc_from_tuple ( fts_trx_table_t ftt,
doc_id_t  doc_id,
const dtuple_t tuple 
)

Fetch the document from tuple, tokenize the text data and insert the text data into fts auxiliary table and its cache.

Moreover this tuple fields doesn't contain any information about externally stored field. This tuple contains data directly converted from mysql.

Parameters
[in]fttFTS transaction table
[in]doc_iddoc id
[in]tupletuple from where data can be retrieved and tuple should be arranged in table schema order.

◆ fts_add_doc_id_column()

void fts_add_doc_id_column ( dict_table_t table,
mem_heap_t heap 
)

Add the FTS document id hidden column.

Parameters
[in,out]tableTable with FTS index
[in]heapTemporary memory heap, or NULL

◆ fts_add_index()

void fts_add_index ( dict_index_t index,
dict_table_t table 
)

Add a newly create index in FTS cache.

table

Add a newly create index in FTS cache.

Parameters
indexFTS index to be added
tabletable

◆ fts_cache_clear()

void fts_cache_clear ( fts_cache_t cache)

Clear cache.

Parameters
[in,out]cachefts cache

◆ fts_cache_create()

fts_cache_t * fts_cache_create ( dict_table_t table)

Create a FTS cache.

table owns the FTS cache

Parameters
tablein: table owns the FTS cache

◆ fts_cache_index_cache_create()

fts_index_cache_t * fts_cache_index_cache_create ( dict_table_t table,
dict_index_t index 
)

Create a FTS index cache.

Returns
Index Cache in: FTS index

Create a FTS index cache.

Returns
Index Cache
Parameters
tablein: table with FTS index
indexin: FTS index

◆ fts_cache_index_cache_remove()

void fts_cache_index_cache_remove ( dict_table_t table,
dict_index_t index 
)

Remove a FTS index cache.

Parameters
[in]tabletable with FTS index
[in]indexFTS index

◆ fts_cache_init()

void fts_cache_init ( fts_cache_t cache)

Initialize things in cache.

in: cache

Initialize things in cache.

Parameters
cachein: cache to initialize

◆ fts_check_cached_index()

bool fts_check_cached_index ( dict_table_t table)

Check indexes in the fts->indexes is also present in index cache and table->indexes list.

Returns
true if all indexes match in: Table where indexes are dropped
true if all indexes match
Parameters
tablein: Table where indexes are dropped

◆ fts_check_common_tables_exist()

bool fts_check_common_tables_exist ( const dict_table_t table)

Check if common tables already exist.

Parameters
[in]tabletable with fts index
Returns
true on success, false on failure

◆ fts_commit()

dberr_t fts_commit ( trx_t trx)

The given transaction is about to be committed; do whatever is necessary from the FTS system's POV.

Returns
DB_SUCCESS or error code in: transaction
DB_SUCCESS or error code
Parameters
trxin: transaction

◆ fts_create()

fts_t * fts_create ( dict_table_t table)

Create an instance of fts_t.

Returns
instance of fts_t out: table with FTS indexes
instance of fts_t
Parameters
tablein/out: table with FTS indexes

◆ fts_create_common_dd_tables()

bool fts_create_common_dd_tables ( const dict_table_t table)

Update DD system table for auxiliary common tables for an FTS index.

Parameters
[in]tabledict table instance
Returns
true on success, false on failure

◆ fts_create_common_tables()

dberr_t fts_create_common_tables ( trx_t trx,
const dict_table_t table,
const char *  name,
bool  skip_doc_id_index 
)

Creates the common auxiliary tables needed for supporting an FTS index on the given table.

row_mysql_lock_data_dictionary must have been called before this. The following tables are created. CREATE TABLE $FTS_PREFIX_DELETED (doc_id BIGINT UNSIGNED, UNIQUE CLUSTERED INDEX on doc_id) CREATE TABLE $FTS_PREFIX_DELETED_CACHE (doc_id BIGINT UNSIGNED, UNIQUE CLUSTERED INDEX on doc_id) CREATE TABLE $FTS_PREFIX_BEING_DELETED (doc_id BIGINT UNSIGNED, UNIQUE CLUSTERED INDEX on doc_id) CREATE TABLE $FTS_PREFIX_BEING_DELETED_CACHE (doc_id BIGINT UNSIGNED, UNIQUE CLUSTERED INDEX on doc_id) CREATE TABLE $FTS_PREFIX_CONFIG (key CHAR(50), value CHAR(200), UNIQUE CLUSTERED INDEX on key)

Parameters
[in,out]trxtransaction
[in]tabletable with FTS index
[in]nametable name normalized
[in]skip_doc_id_indexSkip index on doc id
Returns
DB_SUCCESS if succeed

◆ fts_create_doc_id()

dberr_t fts_create_doc_id ( dict_table_t table,
dtuple_t row,
mem_heap_t heap 
)

Create a new document id.

Parameters
[in]tableRow is of this table.
[in,out]rowAdd doc id value to this row. This is the current row that is being inserted.
[in]heapMemory heap on which the doc_id object will be created.
Returns
DB_SUCCESS if all went well else error

◆ fts_create_index_dd_tables()

dberr_t fts_create_index_dd_tables ( dict_table_t table)

Check if a table has FTS index needs to have its auxiliary index tables' metadata updated in DD.

Parameters
[in,out]tabletable to check
Returns
DB_SUCCESS or error code

◆ fts_create_index_tables()

dberr_t fts_create_index_tables ( trx_t trx,
dict_index_t index 
)

Creates the column specific ancillary tables needed for supporting an FTS index on the given table.

row_mysql_lock_data_dictionary must have been called before this.

All FTS AUX Index tables have the following schema. CREATE TABLE $FTS_PREFIX_INDEX_[1-6]( word VARCHAR(FTS_MAX_WORD_LEN), first_doc_id INT NOT NULL, last_doc_id UNSIGNED NOT NULL, doc_count UNSIGNED INT NOT NULL, ilist VARBINARY NOT NULL, UNIQUE CLUSTERED INDEX ON (word, first_doc_id))

Parameters
[in,out]trxtransaction
[in]indexindex instance
Returns
DB_SUCCESS or error code

◆ fts_create_index_tables_low()

dberr_t fts_create_index_tables_low ( trx_t trx,
dict_index_t index,
const char *  table_name,
table_id_t  table_id 
)

Create auxiliary index tables for an FTS index.

Parameters
[in,out]trxtransaction
[in]indexthe index instance
[in]table_nametable name
[in]table_idthe table id
Returns
DB_SUCCESS or error code

◆ fts_detach_aux_tables()

void fts_detach_aux_tables ( const dict_table_t table,
bool  dict_locked 
)

Allow all the auxiliary tables of specified base table to be evictable if they exist, if not exist just ignore.

Parameters
[in]tableInnoDB table object
[in]dict_lockedTrue if we have dict_sys mutex

◆ fts_doc_ids_create()

fts_doc_ids_t * fts_doc_ids_create ( void  )

Create a new fts_doc_ids_t.

Returns
new fts_doc_ids_t.
new fts_doc_ids_t

◆ fts_doc_ids_free()

void fts_doc_ids_free ( fts_doc_ids_t doc_ids)

Free a fts_doc_ids_t.

in: doc_ids to free

◆ fts_drop_dd_tables()

bool fts_drop_dd_tables ( const aux_name_vec_t aux_vec,
bool  file_per_table 
)

Drop FTS AUX table DD table objects in vector.

Parameters
[in]aux_vecaux table name vector
[in]file_per_tablewhether file per table
Returns
true on success, false on failure.

◆ fts_drop_index()

dberr_t fts_drop_index ( dict_table_t table,
dict_index_t index,
trx_t trx,
aux_name_vec_t aux_vec,
bool  adding_another 
)

Drop auxiliary tables related to an FTS index.

Parameters
[in]tableTable where indexes are dropped
[in]indexIndex to be dropped
[in]trxTransaction for the drop
[in,out]aux_vecAux table name vector
[in]adding_anotherAnother FTS index is to be added as part of the same transaction
Returns
DB_SUCCESS or error number

◆ fts_drop_index_tables()

dberr_t fts_drop_index_tables ( trx_t trx,
dict_index_t index,
aux_name_vec_t aux_vec 
)

Since we do a horizontal split on the index table, we need to drop all the split tables.

Parameters
[in]trxtransaction
[in]indexfts index
[out]aux_vecdropped table names vector
Returns
DB_SUCCESS or error code

◆ fts_drop_tables()

dberr_t fts_drop_tables ( trx_t trx,
dict_table_t table,
aux_name_vec_t aux_vec 
)

Drops the ancillary tables needed for supporting an FTS index on a given table.

row_mysql_lock_data_dictionary must have been called before this.

Parameters
[in,out]trxtransaction
[in]tabletable has the fts index
[in,out]aux_vecfts aux table name vector
Returns
DB_SUCCESS or error code

◆ fts_empty_common_tables()

dberr_t fts_empty_common_tables ( trx_t trx,
dict_table_t table 
)

Empty all common talbes.

Parameters
[in,out]trxtransaction
[in]tabledict table
Returns
DB_SUCCESS or error code.

◆ fts_free()

void fts_free ( dict_table_t table)

Free the FTS resources.

in/out: table with FTS indexes

Parameters
tablein/out: table with FTS indexes

◆ fts_free_aux_names()

void fts_free_aux_names ( aux_name_vec_t aux_vec)

Free FTS AUX table names in vector.

Parameters
[in]aux_vecaux table name vector

◆ fts_freeze_aux_tables()

void fts_freeze_aux_tables ( const dict_table_t table)

Freeze all auiliary tables to be not evictable if exist, with dict_mutex held.

Parameters
[in]tableInnoDB table object

◆ fts_get_doc_id_from_rec()

doc_id_t fts_get_doc_id_from_rec ( dict_table_t table,
const rec_t rec,
const dict_index_t index,
mem_heap_t heap 
)

Extract the doc id from the record that belongs to index.

Parameters
[in]tabletable
[in]recrecord contains FTS_DOC_ID
[in]indexindex of rec
[in]heapheap memory
Returns
doc id that was extracted from rec

◆ fts_get_doc_id_from_row()

doc_id_t fts_get_doc_id_from_row ( dict_table_t table,
dtuple_t row 
)

Extract the doc id from the FTS hidden column.

in: row whose FTS doc id we want to extract.

Returns
doc id that was extracted from rec
Parameters
tablein: table
rowin: row whose FTS doc id we want to extract.

◆ fts_get_max_doc_id()

doc_id_t fts_get_max_doc_id ( dict_table_t table)

Get maximum Doc ID in a table if index "FTS_DOC_ID_INDEX" exists.

Returns
max Doc ID or 0 if index "FTS_DOC_ID_INDEX" does not exist in: user table
max Doc ID or 0 if index "FTS_DOC_ID_INDEX" does not exist
Parameters
tablein: user table

◆ fts_get_next_doc_id()

dberr_t fts_get_next_doc_id ( const dict_table_t table,
doc_id_t doc_id 
)

Get the next available document id.

This function creates a new transaction to generate the document id.

Returns
DB_SUCCESS if OK out: new document id
DB_SUCCESS if OK
Parameters
tablein: table
doc_idout: new document id

◆ fts_get_parent_table_name()

char * fts_get_parent_table_name ( const char *  aux_table_name,
ulint  aux_table_len 
)

◆ fts_get_rows_count()

ulint fts_get_rows_count ( fts_table_t fts_table)

Fetch COUNT(*) from specified table.

Returns
the number of rows in the table in: fts table to read
the number of rows in the table
Parameters
fts_tablein: fts table to read

◆ fts_get_token_size()

ulint fts_get_token_size ( const CHARSET_INFO cs,
const char *  token,
ulint  len 
)

Get token char size by charset.

Returns
the number of token char size in: token length
token size
Parameters
csin: Character set
tokenin: token
lenin: token length

◆ fts_index_get_charset()

CHARSET_INFO * fts_index_get_charset ( dict_index_t index)

Create an FTS index cache.

in: FTS index

Parameters
indexin: FTS index

◆ fts_init_doc_id()

doc_id_t fts_init_doc_id ( const dict_table_t table)

Get the initial Doc ID by consulting the CONFIG table.

Returns
initial Doc ID in: table
initial Doc ID
Parameters
tablein: table

◆ fts_init_index()

bool fts_init_index ( dict_table_t table,
bool  has_cache_lock 
)

This function brings FTS index in sync when FTS index is first used.

There are documents that have not yet sync-ed to auxiliary tables from last server abnormally shutdown, we will need to bring such document into FTS cache before any further operations

Returns
true if all OK in: Whether we already have cache lock

There are documents that have not yet sync-ed to auxiliary tables from last server abnormally shutdown, we will need to bring such document into FTS cache before any further operations

Returns
true if all OK
Parameters
tablein: Table with FTS
has_cache_lockin: Whether we already have cache lock

◆ fts_is_aux_table_name()

bool fts_is_aux_table_name ( fts_aux_table_t table,
const char *  name,
ulint  len 
)

Check if a table is an FTS auxiliary table name.

Parameters
[out]tableFTS table info
[in]nameTable name
[in]lenLength of table name
Returns
true if the name matches an auxiliary table name pattern

◆ fts_load_stopword()

bool fts_load_stopword ( const dict_table_t table,
trx_t trx,
const char *  global_stopword_table,
const char *  session_stopword_table,
bool  stopword_is_on,
bool  reload 
)

This function loads specified stopword into FTS cache.

Returns
true if success in: Whether it is during reload of FTS table

This function loads specified stopword into FTS cache.

It also records/fetches stopword configuration to/from FTS configure table, depending on whether we are creating or reloading the FTS.

Returns
true if load operation is successful
Parameters
tablein: Table with FTS
trxin: Transactions
global_stopword_tablein: Global stopword table name
session_stopword_tablein: Session stopword table name
stopword_is_onin: Whether stopword option is turned on/off
reloadin: Whether it is for reloading FTS table

◆ fts_lock_all_aux_tables()

dberr_t fts_lock_all_aux_tables ( THD thd,
dict_table_t table 
)

Lock all FTS AUX tables (for dropping table)

Parameters
[in]thdthread locking the AUX table
[in]tabletable has the fts index
Returns
DB_SUCCESS or error code

◆ fts_optimize_init()

void fts_optimize_init ( void  )

Startup the optimize thread and create the work queue.

◆ fts_optimize_remove_table()

void fts_optimize_remove_table ( dict_table_t table)

Remove the table from the OPTIMIZER's list.

We do wait for acknowledgement from the consumer of the message. in: table to remove

We do wait for acknowledgement from the consumer of the message.

Parameters
tablein: table to remove

◆ fts_optimize_request_sync_table()

void fts_optimize_request_sync_table ( dict_table_t table)

Send sync fts cache for the table.

Parameters
[in]tabletable to sync

◆ fts_optimize_shutdown()

void fts_optimize_shutdown ( )

Shutdown fts optimize thread.

◆ fts_optimize_table()

dberr_t fts_optimize_table ( dict_table_t table)

Run OPTIMIZE on the given table.

Returns
DB_SUCCESS if all OK in: table to optimiza
DB_SUCCESS if all OK
Parameters
tablein: table to optimize

◆ fts_query()

dberr_t fts_query ( trx_t trx,
dict_index_t index,
uint  flags,
const byte query_str,
ulint  query_len,
fts_result_t **  result,
ulonglong  limit 
)

FTS Query entry point.

Parameters
[in]trxtransaction
[in]indexfts index to search
[in]flagsFTS search mode
[in]query_strFTS query
[in]query_lenFTS query string len in bytes
[in,out]resultresult doc ids
[in]limitlimit value
Returns
DB_SUCCESS if successful otherwise error code

◆ fts_query_free_result()

void fts_query_free_result ( fts_result_t result)

FTS Query free result, returned by fts_query().

in: result instance to free.

Parameters
resultin: result instance to free.

◆ fts_query_sort_result_on_rank()

void fts_query_sort_result_on_rank ( fts_result_t result)

FTS Query sort result, returned by fts_query() on fts_ranking_t::rank.

out: result instance to sort.

Parameters
resultout: result instance to sort.

◆ fts_rename_aux_tables()

dberr_t fts_rename_aux_tables ( dict_table_t table,
const char *  new_name,
trx_t trx,
bool  replay 
)

Rename auxiliary tables for all fts index for a table.

Returns
DB_SUCCESS or error code Whether in replay stage

This(rename) is due to database name change

Returns
DB_SUCCESS or error code
Parameters
tablein: user Table
new_namein: new table name
trxin: transaction
replayin: Whether in replay stage

◆ fts_retrieve_ranking()

float fts_retrieve_ranking ( fts_result_t result,
doc_id_t  doc_id 
)

Retrieve the FTS Relevance Ranking result for doc with doc_id.

Returns
the relevance ranking value. in: the interested document doc_id
the relevance ranking value, 0 if no ranking value present.
Parameters
resultin: FTS result structure
doc_idin: doc_id of the item to retrieve

◆ fts_savepoint_laststmt_refresh()

void fts_savepoint_laststmt_refresh ( trx_t trx)

Refresh last statement savepoint.

in: transaction

Parameters
trxin: transaction

◆ fts_savepoint_release()

void fts_savepoint_release ( trx_t trx,
const char *  name 
)

Release the savepoint data identified by name.

in: savepoint name

All savepoints created after the named savepoint are kept.

Parameters
trxin: transaction
namein: savepoint name

◆ fts_savepoint_rollback()

void fts_savepoint_rollback ( trx_t trx,
const char *  name 
)

Rollback to and including savepoint identified by name.

in: savepoint name

Rollback to and including savepoint identified by name.

Parameters
trxin: transaction
namein: savepoint name

◆ fts_savepoint_rollback_last_stmt()

void fts_savepoint_rollback_last_stmt ( trx_t trx)

Rollback to and including savepoint identified by name.

in: transaction

Rollback to and including savepoint identified by name.

Parameters
trxin: transaction

◆ fts_savepoint_take()

void fts_savepoint_take ( fts_trx_t fts_trx,
const char *  name 
)

Take a FTS savepoint.

Parameters
[in]fts_trxFts transaction
[in]nameSavepoint name

◆ fts_startup()

void fts_startup ( void  )

FTS initialize.

◆ fts_sync_table()

dberr_t fts_sync_table ( dict_table_t table,
bool  unlock_cache,
bool  wait,
bool  has_dict 
)

Run SYNC on the table, i.e., write out data from the cache to the FTS auxiliary INDEX table and clear the cache at the end.

Parameters
[in,out]tablefts table
[in]unlock_cachewhether unlock cache when write node
[in]waitwhether wait for existing sync to finish
[in]has_dictwhether has dict operation lock
Returns
DB_SUCCESS on success, error code on failure.

◆ fts_table_fetch_doc_ids()

dberr_t fts_table_fetch_doc_ids ( trx_t trx,
fts_table_t fts_table,
fts_doc_ids_t doc_ids 
)

Read the rows from the FTS index.

Returns
DB_SUCCESS if OK in: For collecting doc ids

Read the rows from the FTS index.

Returns
DB_SUCCESS or error code
Parameters
trxin: transaction
fts_tablein: table
doc_idsin: For collecting doc ids

◆ fts_tokenize_document_internal()

int fts_tokenize_document_internal ( MYSQL_FTPARSER_PARAM param,
char *  doc,
int  len 
)

FULLTEXT tokenizer internal in MYSQL_FTPARSER_SIMPLE_MODE.

Returns
0 if tokenize successfully in: document length

FULLTEXT tokenizer internal in MYSQL_FTPARSER_SIMPLE_MODE.

Refer to 'MYSQL_FTPARSER_PARAM' for more detail.

Returns
always returns 0
Parameters
paramin: parser parameter
docin/out: document
lenin: document length

◆ fts_trx_add_op()

void fts_trx_add_op ( trx_t trx,
dict_table_t table,
doc_id_t  doc_id,
fts_row_state  state,
ib_vector_t fts_indexes 
)

Notify the FTS system about an operation on an FTS-indexed table.

Parameters
[in]trxInnodb transaction
[in]tableTable
[in]doc_idDoc id
[in]stateState of the row
[in]fts_indexesFts indexes affected (null=all)

◆ fts_trx_create()

fts_trx_t * fts_trx_create ( trx_t trx)

Create an FTS trx.

Parameters
[in,out]trxInnoDB Transaction
Returns
FTS transaction.

◆ fts_trx_free()

void fts_trx_free ( fts_trx_t fts_trx)

Free an FTS trx.

in, own: FTS trx

◆ fts_update_doc_id()

doc_id_t fts_update_doc_id ( dict_table_t table,
upd_field_t ufield,
doc_id_t next_doc_id 
)

Add new fts doc id to the update vector.

Parameters
[in]tablethe table that contains the FTS index.
[in,out]ufieldthe fts doc id field in the update vector. No new memory is allocated for this in this function.
[in,out]next_doc_idthe fts doc id that has been added to the update vector. If 0, a new fts doc id is automatically generated. The memory provided for this argument will be used by the update vector. Ensure that the life time of this memory matches that of the update vector.
Returns
the fts doc id used in the update vector

◆ fts_update_next_doc_id()

void fts_update_next_doc_id ( trx_t trx,
const dict_table_t table,
const char *  table_name,
doc_id_t  doc_id 
)

Update the next and last Doc ID in the CONFIG table to be the input "doc_id" value (+ 1).

We would do so after each FTS index build or table truncate in: DOC ID to set

We would do so after each FTS index build or table truncate

Parameters
trxin/out: transaction
tablein: table
table_namein: table name, or NULL
doc_idin: DOC ID to set

◆ fts_upgrade_aux_tables()

dberr_t fts_upgrade_aux_tables ( dict_table_t table)

Upgrade FTS AUX Tables.

The FTS common and aux tables are renamed because they have table_id in their name. We move table_ids by DICT_MAX_DD_TABLES offset. Aux tables are registered into DD after rename.

Parameters
[in]tableInnoDB table object
Returns
DB_SUCCESS or error code

◆ fts_upgrade_rename()

dberr_t fts_upgrade_rename ( const dict_table_t table,
bool  rollback 
)

Rename FTS AUX tablespace name from 8.0 format to 5.7 format.

This will be done on upgrade failure

Parameters
[in]tableparent table
[in]rollbackrollback the rename from 8.0 to 5.7 if true, rename to 5.7 format if false, mark the table as evictable
Returns
DB_SUCCESS on success, DB_ERROR on error

◆ fts_valid_stopword_table()

CHARSET_INFO * fts_valid_stopword_table ( const char *  stopword_table_name)

Check whether user supplied stopword table exists and is of the right format.

Returns
the stopword column charset if qualifies in: Stopword table name

Check whether user supplied stopword table exists and is of the right format.

Caller is responsible to hold dictionary locks.

Returns
the stopword column charset if qualifies
Parameters
stopword_table_namein: Stopword table name

◆ innobase_fts_casedn_str()

size_t innobase_fts_casedn_str ( CHARSET_INFO cs,
char *  src,
size_t  src_len,
char *  dst,
size_t  dst_len 
)

Makes all characters in a string lower case.

Parameters
[in]csCharacter set
[in]srcString to put in lower case
[in]src_lenInput string length
[in]dstBuffer for result string
[in]dst_lenBuffer size

◆ innobase_fts_drop_dd_table()

bool innobase_fts_drop_dd_table ( const char *  name,
bool  file_per_table 
)

Drop dd table & tablespace for fts aux table.

Parameters
[in]nametable name
[in]file_per_tableflag whether use file per table
Returns
true on success, false on failure.

◆ innobase_fts_text_cmp()

int innobase_fts_text_cmp ( const void *  cs,
const void *  p1,
const void *  p2 
)

Compare two character string according to their charset.

Parameters
[in]csCharacter set
[in]p1Key
[in]p2Node

◆ innobase_fts_text_cmp_prefix()

int innobase_fts_text_cmp_prefix ( const void *  cs,
const void *  p1,
const void *  p2 
)

Compare two character string according to their charset.

Parameters
[in]csCharacter set
[in]p1Key
[in]p2Node

◆ innobase_mysql_fts_get_token()

ulint innobase_mysql_fts_get_token ( CHARSET_INFO cs,
const byte start,
const byte end,
fts_string_t token 
)

Get the next token from the given string and store it in *token.

out: token's text

It is mostly copied from MyISAM's doc parsing function ft_simple_get_word()

Returns
length of string processed
Parameters
csin: Character set
startin: start of text
endin: one character past end of text
tokenout: token's text

Variable Documentation

◆ fts_default_stopword

const char* fts_default_stopword[]
extern

InnoDB default stopword list: There are different versions of stopwords, the stop words listed below comes from "Google Stopword" list.

Reference: http://meta.wikimedia.org/wiki/Stop_word_list/google_stop_word_list. The final version of InnoDB default stopword list is still pending for decision

◆ fts_enable_diag_print

bool fts_enable_diag_print
extern

Variable specifying whether we do additional FTS diagnostic printout in the log.

◆ fts_internal_tbl_name

char* fts_internal_tbl_name
extern

Variable specifying the table that has Fulltext index to display its content through information schema table.

Variable specifying the table that has Fulltext index to display its content through information schema table.

◆ fts_max_cache_size

ulong fts_max_cache_size
extern

Variable specifying the maximum FTS cache size for each table.

Variable specifying the maximum FTS cache size for each table.

◆ fts_max_token_size

ulong fts_max_token_size
extern

Variable specifying the maximum FTS max token size.

◆ fts_max_total_cache_size

ulong fts_max_total_cache_size
extern

Variable specifying the total memory allocated for FTS cache.

◆ fts_min_token_size

ulong fts_min_token_size
extern

Variable specifying the minimum FTS max token size.

◆ fts_need_sync

bool fts_need_sync
extern

Whether the total memory used for FTS cache is exhausted, and we will need a sync to free some memory.

◆ FTS_NUM_AUX_COMMON

constexpr size_t FTS_NUM_AUX_COMMON = 5
constexpr

The number of FTS AUX common table for a fulltext index.

◆ FTS_NUM_AUX_INDEX

constexpr size_t FTS_NUM_AUX_INDEX = 6
constexpr

The number of FTS index partitions for a fulltext index.

◆ fts_num_word_optimize

ulong fts_num_word_optimize
extern

Variable specifying the number of word to optimize for each optimize table call.

Variable specifying the number of word to optimize for each optimize table call.

◆ FTS_PREFIX

const char* FTS_PREFIX
extern

FTS auxiliary table prefix that are common to all FT indexes.

◆ FTS_PREFIX_5_7

const char* FTS_PREFIX_5_7
extern

FTS auxiliary table prefix that are common to all FT indexes.

◆ fts_result_cache_limit

ulong fts_result_cache_limit
extern

Variable specifying the FTS result cache limit for each query.

Variable specifying the FTS result cache limit for each query.

◆ FTS_SUFFIX_BEING_DELETED

const char* FTS_SUFFIX_BEING_DELETED
extern

◆ FTS_SUFFIX_BEING_DELETED_CACHE

const char* FTS_SUFFIX_BEING_DELETED_CACHE
extern

◆ FTS_SUFFIX_CONFIG

const char* FTS_SUFFIX_CONFIG
extern

◆ FTS_SUFFIX_CONFIG_5_7

const char* FTS_SUFFIX_CONFIG_5_7
extern

◆ FTS_SUFFIX_DELETED

const char* FTS_SUFFIX_DELETED
extern

◆ FTS_SUFFIX_DELETED_CACHE

const char* FTS_SUFFIX_DELETED_CACHE
extern