24 #include <mysql/plugin.h>
26 #define true_word_char(ctype, character) \
27 ((ctype) & (_MY_U | _MY_L | _MY_NMR) || \
29 #define misc_word_char(X) 0
31 #define FT_MAX_WORD_LEN_FOR_SORT 31
33 #define FTPARSER_MEMROOT_ALLOC_SIZE 65536
35 #define COMPILE_STOPWORDS_IN
49 #define LWS_FOR_QUERY LWS_TF
50 #define LWS_IN_USE LWS_LOG
51 #define PRENORM_IN_USE PRENORM_AVG
52 #define NORM_IN_USE NORM_PIVOT
53 #define GWS_IN_USE GWS_PROB
55 #define LWS_TF (count)
56 #define LWS_BINARY (count>0)
57 #define LWS_SQUARE (count*count)
58 #define LWS_LOG (count?(log( (double) count)+1):0)
60 #define PRENORM_NONE (p->weight)
61 #define PRENORM_MAX (p->weight/docstat.max)
62 #define PRENORM_AUG (0.4+0.6*p->weight/docstat.max)
63 #define PRENORM_AVG (p->weight/docstat.sum*docstat.uniq)
64 #define PRENORM_AVGLOG ((1+log(p->weight))/(1+log(docstat.sum/docstat.uniq)))
67 #define NORM_SUM (docstat.nsum)
68 #define NORM_COS (sqrt(docstat.nsum2))
70 #define PIVOT_VAL (0.0115)
71 #define NORM_PIVOT (1+PIVOT_VAL*docstat.uniq)
73 #define GWS_NORM (1/sqrt(sum2))
74 #define GWS_GFIDF (sum/doc_cnt)
76 #define GWS_IDF log(aio->info->state->records/doc_cnt)
77 #define GWS_IDF1 log((double)aio->info->state->records/doc_cnt)
78 #define GWS_PROB ((aio->info->state->records > doc_cnt) ? log(((double)(aio->info->state->records-doc_cnt))/doc_cnt) : 0 )
79 #define GWS_FREQ (1.0/doc_cnt)
80 #define GWS_SQUARED pow(log((double)aio->info->state->records/doc_cnt),2)
81 #define GWS_CUBIC pow(log((double)aio->info->state->records/doc_cnt),3)
82 #define GWS_ENTROPY (1-(suml/sum-log(sum))/log(aio->info->state->records))
86 #define FTB_YES (ft_boolean_syntax[0])
87 #define FTB_EGAL (ft_boolean_syntax[1])
88 #define FTB_NO (ft_boolean_syntax[2])
89 #define FTB_INC (ft_boolean_syntax[3])
90 #define FTB_DEC (ft_boolean_syntax[4])
91 #define FTB_LBR (ft_boolean_syntax[5])
92 #define FTB_RBR (ft_boolean_syntax[6])
93 #define FTB_NEG (ft_boolean_syntax[7])
94 #define FTB_TRUNC (ft_boolean_syntax[8])
95 #define FTB_LQUOT (ft_boolean_syntax[10])
96 #define FTB_RQUOT (ft_boolean_syntax[11])
104 int is_stopword(
char *
word, uint len);
106 uint _ft_make_key(
MI_INFO *, uint , uchar *,
FT_WORD *, my_off_t);
110 uchar ft_simple_get_word(
const CHARSET_INFO *, uchar **,
const uchar *,
116 const uchar *rec, *pos;
120 void _mi_ft_segiterator_dummy_init(
const uchar *, uint,
FT_SEG_ITERATOR *);
128 uint _mi_ft_parse(
TREE *,
MI_INFO *, uint,
const uchar *,
131 FT_INFO *ft_init_nlq_search(
MI_INFO *, uint, uchar *, uint, uint, uchar *);
135 extern const struct _ft_vft _ft_vft_nlq;
136 int ft_nlq_read_next(
FT_INFO *,
char *);
137 float ft_nlq_find_relevance(
FT_INFO *, uchar *, uint);
138 void ft_nlq_close_search(
FT_INFO *);
139 float ft_nlq_get_relevance(
FT_INFO *);
140 my_off_t ft_nlq_get_docid(
FT_INFO *);
141 void ft_nlq_reinit_search(
FT_INFO *);
143 extern const struct _ft_vft _ft_vft_boolean;
144 int ft_boolean_read_next(
FT_INFO *,
char *);
145 float ft_boolean_find_relevance(
FT_INFO *, uchar *, uint);
146 void ft_boolean_close_search(
FT_INFO *);
147 float ft_boolean_get_relevance(
FT_INFO *);
148 my_off_t ft_boolean_get_docid(
FT_INFO *);
149 void ft_boolean_reinit_search(
FT_INFO *);
154 extern void ftparser_call_deinitializer(
MI_INFO *info);