MySQL 9.1.0
Source Code Documentation
ftdefs.h File Reference

Some definitions for full-text indices. More...

#include <math.h>
#include <mysql/plugin.h>
#include <cstdint>
#include "my_tree.h"
#include "mysql/strings/m_ctype.h"
#include "storage/myisam/fulltext.h"
#include "storage/myisam/queues.h"

Go to the source code of this file.

Classes

struct  FT_WORD
 FTS query token. More...
 
struct  _st_ft_seg_iterator
 

Macros

#define FT_MAX_WORD_LEN_FOR_SORT   31
 
#define FTPARSER_MEMROOT_ALLOC_SIZE   65536
 
#define LWS_FOR_QUERY   LWS_TF
 
#define LWS_IN_USE   LWS_LOG
 
#define PRENORM_IN_USE   PRENORM_AVG
 
#define NORM_IN_USE   NORM_PIVOT
 
#define GWS_IN_USE   GWS_PROB
 
#define LWS_TF   (count)
 
#define LWS_BINARY   (count > 0)
 
#define LWS_SQUARE   (count * count)
 
#define LWS_LOG   (count ? (log((double)count) + 1) : 0)
 
#define PRENORM_NONE   (p->weight)
 
#define PRENORM_MAX   (p->weight / docstat.max)
 
#define PRENORM_AUG   (0.4 + 0.6 * p->weight / docstat.max)
 
#define PRENORM_AVG   (p->weight / docstat.sum * docstat.uniq)
 
#define PRENORM_AVGLOG    ((1 + log(p->weight)) / (1 + log(docstat.sum / docstat.uniq)))
 
#define NORM_NONE   (1)
 
#define NORM_SUM   (docstat.nsum)
 
#define NORM_COS   (sqrt(docstat.nsum2))
 
#define PIVOT_VAL   (0.0115)
 
#define NORM_PIVOT   (1 + PIVOT_VAL * docstat.uniq)
 
#define GWS_NORM   (1 / sqrt(sum2))
 
#define GWS_GFIDF   (sum / doc_cnt)
 
#define GWS_IDF   log(aio->info->state->records / doc_cnt)
 
#define GWS_IDF1   log((double)aio->info->state->records / doc_cnt)
 
#define GWS_PROB
 
#define GWS_FREQ   (1.0 / doc_cnt)
 
#define GWS_SQUARED   pow(log((double)aio->info->state->records / doc_cnt), 2)
 
#define GWS_CUBIC   pow(log((double)aio->info->state->records / doc_cnt), 3)
 
#define GWS_ENTROPY    (1 - (suml / sum - log(sum)) / log(aio->info->state->records))
 
#define FTB_YES   (ft_boolean_syntax[0])
 
#define FTB_EGAL   (ft_boolean_syntax[1])
 
#define FTB_NO   (ft_boolean_syntax[2])
 
#define FTB_INC   (ft_boolean_syntax[3])
 
#define FTB_DEC   (ft_boolean_syntax[4])
 
#define FTB_LBR   (ft_boolean_syntax[5])
 
#define FTB_RBR   (ft_boolean_syntax[6])
 
#define FTB_NEG   (ft_boolean_syntax[7])
 
#define FTB_TRUNC   (ft_boolean_syntax[8])
 
#define FTB_LQUOT   (ft_boolean_syntax[10])
 
#define FTB_RQUOT   (ft_boolean_syntax[11])
 

Typedefs

typedef struct _st_ft_seg_iterator FT_SEG_ITERATOR
 

Functions

bool true_word_char (int c, uint8_t ch)
 
int is_stopword (char *word, uint len)
 
uint _ft_make_key (MI_INFO *, uint, uchar *, FT_WORD *, my_off_t)
 
uchar ft_get_word (const CHARSET_INFO *, uchar **, uchar *, FT_WORD *, MYSQL_FTPARSER_BOOLEAN_INFO *)
 
uchar ft_simple_get_word (const CHARSET_INFO *, uchar **, const uchar *, FT_WORD *, bool)
 
void _mi_ft_segiterator_init (MI_INFO *, uint, const uchar *, FT_SEG_ITERATOR *)
 
void _mi_ft_segiterator_dummy_init (const uchar *, uint, FT_SEG_ITERATOR *)
 
uint _mi_ft_segiterator (FT_SEG_ITERATOR *)
 
void ft_parse_init (TREE *, const CHARSET_INFO *)
 
int ft_parse (TREE *, uchar *, int, struct st_mysql_ftparser *parser, MYSQL_FTPARSER_PARAM *, MEM_ROOT *)
 
FT_WORDft_linearize (TREE *, MEM_ROOT *)
 
FT_WORD_mi_ft_parserecord (MI_INFO *, uint, const uchar *, MEM_ROOT *)
 
uint _mi_ft_parse (TREE *, MI_INFO *, uint, const uchar *, MYSQL_FTPARSER_PARAM *, MEM_ROOT *)
 
FT_INFOft_init_nlq_search (MI_INFO *, uint, uchar *, uint, uint, uchar *)
 
FT_INFOft_init_boolean_search (MI_INFO *, uint, uchar *, uint, const CHARSET_INFO *)
 
int ft_nlq_read_next (FT_INFO *, char *)
 
float ft_nlq_find_relevance (FT_INFO *, uchar *, uint)
 
void ft_nlq_close_search (FT_INFO *)
 
float ft_nlq_get_relevance (FT_INFO *)
 
my_off_t ft_nlq_get_docid (FT_INFO *)
 
void ft_nlq_reinit_search (FT_INFO *)
 
int ft_boolean_read_next (FT_INFO *, char *)
 
float ft_boolean_find_relevance (FT_INFO *, uchar *, uint)
 
void ft_boolean_close_search (FT_INFO *)
 
float ft_boolean_get_relevance (FT_INFO *)
 
my_off_t ft_boolean_get_docid (FT_INFO *)
 
void ft_boolean_reinit_search (FT_INFO *)
 
MYSQL_FTPARSER_PARAMftparser_alloc_param (MI_INFO *info)
 
MYSQL_FTPARSER_PARAMftparser_call_initializer (MI_INFO *info, uint keynr, uint paramnr)
 
void ftparser_call_deinitializer (MI_INFO *info)
 

Variables

const struct _ft_vft _ft_vft_nlq
 
const struct _ft_vft _ft_vft_boolean
 

Detailed Description

Some definitions for full-text indices.

Macro Definition Documentation

◆ FT_MAX_WORD_LEN_FOR_SORT

#define FT_MAX_WORD_LEN_FOR_SORT   31

◆ FTB_DEC

#define FTB_DEC   (ft_boolean_syntax[4])

◆ FTB_EGAL

#define FTB_EGAL   (ft_boolean_syntax[1])

◆ FTB_INC

#define FTB_INC   (ft_boolean_syntax[3])

◆ FTB_LBR

#define FTB_LBR   (ft_boolean_syntax[5])

◆ FTB_LQUOT

#define FTB_LQUOT   (ft_boolean_syntax[10])

◆ FTB_NEG

#define FTB_NEG   (ft_boolean_syntax[7])

◆ FTB_NO

#define FTB_NO   (ft_boolean_syntax[2])

◆ FTB_RBR

#define FTB_RBR   (ft_boolean_syntax[6])

◆ FTB_RQUOT

#define FTB_RQUOT   (ft_boolean_syntax[11])

◆ FTB_TRUNC

#define FTB_TRUNC   (ft_boolean_syntax[8])

◆ FTB_YES

#define FTB_YES   (ft_boolean_syntax[0])

◆ FTPARSER_MEMROOT_ALLOC_SIZE

#define FTPARSER_MEMROOT_ALLOC_SIZE   65536

◆ GWS_CUBIC

#define GWS_CUBIC   pow(log((double)aio->info->state->records / doc_cnt), 3)

◆ GWS_ENTROPY

#define GWS_ENTROPY    (1 - (suml / sum - log(sum)) / log(aio->info->state->records))

◆ GWS_FREQ

#define GWS_FREQ   (1.0 / doc_cnt)

◆ GWS_GFIDF

#define GWS_GFIDF   (sum / doc_cnt)

◆ GWS_IDF

#define GWS_IDF   log(aio->info->state->records / doc_cnt)

◆ GWS_IDF1

#define GWS_IDF1   log((double)aio->info->state->records / doc_cnt)

◆ GWS_IN_USE

#define GWS_IN_USE   GWS_PROB

◆ GWS_NORM

#define GWS_NORM   (1 / sqrt(sum2))

◆ GWS_PROB

#define GWS_PROB
Value:
((aio->info->state->records > doc_cnt) \
? log(((double)(aio->info->state->records - doc_cnt)) / doc_cnt) \
: 0)

◆ GWS_SQUARED

#define GWS_SQUARED   pow(log((double)aio->info->state->records / doc_cnt), 2)

◆ LWS_BINARY

#define LWS_BINARY   (count > 0)

◆ LWS_FOR_QUERY

#define LWS_FOR_QUERY   LWS_TF

◆ LWS_IN_USE

#define LWS_IN_USE   LWS_LOG

◆ LWS_LOG

#define LWS_LOG   (count ? (log((double)count) + 1) : 0)

◆ LWS_SQUARE

#define LWS_SQUARE   (count * count)

◆ LWS_TF

#define LWS_TF   (count)

◆ NORM_COS

#define NORM_COS   (sqrt(docstat.nsum2))

◆ NORM_IN_USE

#define NORM_IN_USE   NORM_PIVOT

◆ NORM_NONE

#define NORM_NONE   (1)

◆ NORM_PIVOT

#define NORM_PIVOT   (1 + PIVOT_VAL * docstat.uniq)

◆ NORM_SUM

#define NORM_SUM   (docstat.nsum)

◆ PIVOT_VAL

#define PIVOT_VAL   (0.0115)

◆ PRENORM_AUG

#define PRENORM_AUG   (0.4 + 0.6 * p->weight / docstat.max)

◆ PRENORM_AVG

#define PRENORM_AVG   (p->weight / docstat.sum * docstat.uniq)

◆ PRENORM_AVGLOG

#define PRENORM_AVGLOG    ((1 + log(p->weight)) / (1 + log(docstat.sum / docstat.uniq)))

◆ PRENORM_IN_USE

#define PRENORM_IN_USE   PRENORM_AVG

◆ PRENORM_MAX

#define PRENORM_MAX   (p->weight / docstat.max)

◆ PRENORM_NONE

#define PRENORM_NONE   (p->weight)

Typedef Documentation

◆ FT_SEG_ITERATOR

Function Documentation

◆ _ft_make_key()

uint _ft_make_key ( MI_INFO info,
uint  keynr,
uchar keybuf,
FT_WORD wptr,
my_off_t  filepos 
)

◆ _mi_ft_parse()

uint _mi_ft_parse ( TREE parsed,
MI_INFO info,
uint  keynr,
const uchar record,
MYSQL_FTPARSER_PARAM param,
MEM_ROOT mem_root 
)

◆ _mi_ft_parserecord()

FT_WORD * _mi_ft_parserecord ( MI_INFO info,
uint  keynr,
const uchar record,
MEM_ROOT mem_root 
)

◆ _mi_ft_segiterator()

uint _mi_ft_segiterator ( FT_SEG_ITERATOR ftsi)

◆ _mi_ft_segiterator_dummy_init()

void _mi_ft_segiterator_dummy_init ( const uchar record,
uint  len,
FT_SEG_ITERATOR ftsi 
)

◆ _mi_ft_segiterator_init()

void _mi_ft_segiterator_init ( MI_INFO info,
uint  keynr,
const uchar record,
FT_SEG_ITERATOR ftsi 
)

◆ ft_boolean_close_search()

void ft_boolean_close_search ( FT_INFO ftb_base)

◆ ft_boolean_find_relevance()

float ft_boolean_find_relevance ( FT_INFO ftb_base,
uchar record,
uint  length 
)

◆ ft_boolean_get_docid()

my_off_t ft_boolean_get_docid ( FT_INFO )

◆ ft_boolean_get_relevance()

float ft_boolean_get_relevance ( FT_INFO ftb_base)

◆ ft_boolean_read_next()

int ft_boolean_read_next ( FT_INFO ftb_base,
char *  record 
)

◆ ft_boolean_reinit_search()

void ft_boolean_reinit_search ( FT_INFO ftb)

◆ ft_get_word()

uchar ft_get_word ( const CHARSET_INFO cs,
uchar **  start,
uchar end,
FT_WORD word,
MYSQL_FTPARSER_BOOLEAN_INFO param 
)

◆ ft_init_boolean_search()

FT_INFO * ft_init_boolean_search ( MI_INFO info,
uint  keynr,
uchar query,
uint  query_len,
const CHARSET_INFO cs 
)

◆ ft_init_nlq_search()

FT_INFO * ft_init_nlq_search ( MI_INFO info,
uint  keynr,
uchar query,
uint  query_len,
uint  flags,
uchar record 
)

◆ ft_linearize()

FT_WORD * ft_linearize ( TREE wtree,
MEM_ROOT mem_root 
)

◆ ft_nlq_close_search()

void ft_nlq_close_search ( FT_INFO handler)

◆ ft_nlq_find_relevance()

float ft_nlq_find_relevance ( FT_INFO handler_base,
uchar record,
uint  length 
)

◆ ft_nlq_get_docid()

my_off_t ft_nlq_get_docid ( FT_INFO )

◆ ft_nlq_get_relevance()

float ft_nlq_get_relevance ( FT_INFO handler_base)

◆ ft_nlq_read_next()

int ft_nlq_read_next ( FT_INFO handler_base,
char *  record 
)

◆ ft_nlq_reinit_search()

void ft_nlq_reinit_search ( FT_INFO handler_base)

◆ ft_parse()

int ft_parse ( TREE wtree,
uchar doc,
int  doclen,
struct st_mysql_ftparser parser,
MYSQL_FTPARSER_PARAM param,
MEM_ROOT mem_root 
)

◆ ft_parse_init()

void ft_parse_init ( TREE wtree,
const CHARSET_INFO cs 
)

◆ ft_simple_get_word()

uchar ft_simple_get_word ( const CHARSET_INFO cs,
uchar **  start,
const uchar end,
FT_WORD word,
bool  skip_stopwords 
)

◆ ftparser_alloc_param()

MYSQL_FTPARSER_PARAM * ftparser_alloc_param ( MI_INFO info)

◆ ftparser_call_deinitializer()

void ftparser_call_deinitializer ( MI_INFO info)

◆ ftparser_call_initializer()

MYSQL_FTPARSER_PARAM * ftparser_call_initializer ( MI_INFO info,
uint  keynr,
uint  paramnr 
)

◆ is_stopword()

int is_stopword ( char *  word,
uint  len 
)

◆ true_word_char()

bool true_word_char ( int  c,
uint8_t  ch 
)
inline

Variable Documentation

◆ _ft_vft_boolean

const struct _ft_vft _ft_vft_boolean
extern

◆ _ft_vft_nlq

const struct _ft_vft _ft_vft_nlq
extern