Debian Codegraph @

storage/maria/ma_ftdefs.h

raw symbols SCIP
1 /* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
6
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
15
16 /* Written by Sergei A. Golubchik, who has a shared copyright to this code */
17
18 /* some definitions for full-text indices */
19
20 #include "ma_fulltext.h"cxx . . $ `<file>/storage/maria/ma_fulltext.h`/
21 #include <m_ctype.h>cxx . . $ `<file>/include/m_ctype.h`/
22 #include <my_tree.h>cxx . . $ `<file>/include/my_tree.h`/
23 #include <queues.h>cxx . . $ `<file>/include/queues.h`/
24 #include <mysql/plugin.h>cxx . . $ `<file>/include/mysql/plugin.h`/
25
26 #define true_word_charcxx . . $ `storage/maria/ma_ftdefs.h:26:9`!(ctype, character) \
27 ((ctype) & (_MY_U | _MY_L | _MY_NMR) || \
28 (character) == '_')
29 #define misc_word_charcxx . . $ `storage/maria/ma_ftdefs.h:29:9`!(X) 0
30
31 #define FT_MAX_WORD_LEN_FOR_SORTcxx . . $ `storage/maria/ma_ftdefs.h:31:9`! 31
32
33 #define FTPARSER_MEMROOT_ALLOC_SIZEcxx . . $ `storage/maria/ma_ftdefs.h:33:9`! 65536
34
35 #define COMPILE_STOPWORDS_INcxx . . $ `storage/maria/ma_ftdefs.h:35:9`!
36
37 /* Interested readers may consult SMART
38 (ftp://ftp.cs.cornell.edu/pub/smart/smart.11.0.tar.Z)
39 for an excellent implementation of vector space model we use.
40 It also demonstrate the usage of different weghting techniques.
41 This code, though, is completely original and is not based on the
42 SMART code but was in some cases inspired by it.
43
44 NORM_PIVOT was taken from the article
45 A.Singhal, C.Buckley, M.Mitra, "Pivoted Document Length Normalization",
46 ACM SIGIR'96, 21-29, 1996
47 */
48
49 #define LWS_FOR_QUERYcxx . . $ `storage/maria/ma_ftdefs.h:49:9`! LWS_TF
50 #define LWS_IN_USEcxx . . $ `storage/maria/ma_ftdefs.h:50:9`! LWS_LOG
51 #define PRENORM_IN_USEcxx . . $ `storage/maria/ma_ftdefs.h:51:9`! PRENORM_AVG
52 #define NORM_IN_USEcxx . . $ `storage/maria/ma_ftdefs.h:52:9`! NORM_PIVOT
53 #define GWS_IN_USEcxx . . $ `storage/maria/ma_ftdefs.h:53:9`! GWS_PROB
54 /*==============================================================*/
55 #define LWS_TFcxx . . $ `storage/maria/ma_ftdefs.h:55:9`! (count)
56 #define LWS_BINARYcxx . . $ `storage/maria/ma_ftdefs.h:56:9`! (count>0)
57 #define LWS_SQUAREcxx . . $ `storage/maria/ma_ftdefs.h:57:9`! (count*count)
58 #define LWS_LOGcxx . . $ `storage/maria/ma_ftdefs.h:58:9`! (count?(log( (double) count)+1):0)
59 /*--------------------------------------------------------------*/
60 #define PRENORM_NONEcxx . . $ `storage/maria/ma_ftdefs.h:60:9`! (p->weight)
61 #define PRENORM_MAXcxx . . $ `storage/maria/ma_ftdefs.h:61:9`! (p->weight/docstat.max)
62 #define PRENORM_AUGcxx . . $ `storage/maria/ma_ftdefs.h:62:9`! (0.4+0.6*p->weight/docstat.max)
63 #define PRENORM_AVGcxx . . $ `storage/maria/ma_ftdefs.h:63:9`! (p->weight/docstat.sum*docstat.uniq)
64 #define PRENORM_AVGLOGcxx . . $ `storage/maria/ma_ftdefs.h:64:9`! ((1+log(p->weight))/(1+log(docstat.sum/docstat.uniq)))
65 /*--------------------------------------------------------------*/
66 #define NORM_NONEcxx . . $ `storage/maria/ma_ftdefs.h:66:9`! (1)
67 #define NORM_SUMcxx . . $ `storage/maria/ma_ftdefs.h:67:9`! (docstat.nsum)
68 #define NORM_COScxx . . $ `storage/maria/ma_ftdefs.h:68:9`! (sqrt(docstat.nsum2))
69
70 #define PIVOT_VALcxx . . $ `storage/maria/ma_ftdefs.h:70:9`! (0.0115)
71 #define NORM_PIVOTcxx . . $ `storage/maria/ma_ftdefs.h:71:9`! (1+PIVOT_VAL*docstat.uniq)
72 /*---------------------------------------------------------------*/
73 #define GWS_NORMcxx . . $ `storage/maria/ma_ftdefs.h:73:9`! (1/sqrt(sum2))
74 #define GWS_GFIDFcxx . . $ `storage/maria/ma_ftdefs.h:74:9`! (sum/doc_cnt)
75 /* Mysterious, but w/o (double) GWS_IDF performs better :-o */
76 #define GWS_IDFcxx . . $ `storage/maria/ma_ftdefs.h:76:9`! log(aio->info->state->records/doc_cnt)
77 #define GWS_IDF1cxx . . $ `storage/maria/ma_ftdefs.h:77:9`! log((double)aio->info->state->records/doc_cnt)
78 #define GWS_PROBcxx . . $ `storage/maria/ma_ftdefs.h:78:9`! ((aio->info->state->records > doc_cnt) ? log(((double)(aio->info->state->records-doc_cnt))/doc_cnt) : 0 )
79 #define GWS_FREQcxx . . $ `storage/maria/ma_ftdefs.h:79:9`! (1.0/doc_cnt)
80 #define GWS_SQUAREDcxx . . $ `storage/maria/ma_ftdefs.h:80:9`! pow(log((double)aio->info->state->records/doc_cnt),2)
81 #define GWS_CUBICcxx . . $ `storage/maria/ma_ftdefs.h:81:9`! pow(log((double)aio->info->state->records/doc_cnt),3)
82 #define GWS_ENTROPYcxx . . $ `storage/maria/ma_ftdefs.h:82:9`! (1-(suml/sum-log(sum))/log(aio->info->state->records))
83 /*=================================================================*/
84
85 /* Boolean search operators */
86 #define FTB_YEScxx . . $ `storage/maria/ma_ftdefs.h:86:9`! (ft_boolean_syntax[0])
87 #define FTB_EGALcxx . . $ `storage/maria/ma_ftdefs.h:87:9`! (ft_boolean_syntax[1])
88 #define FTB_NOcxx . . $ `storage/maria/ma_ftdefs.h:88:9`! (ft_boolean_syntax[2])
89 #define FTB_INCcxx . . $ `storage/maria/ma_ftdefs.h:89:9`! (ft_boolean_syntax[3])
90 #define FTB_DECcxx . . $ `storage/maria/ma_ftdefs.h:90:9`! (ft_boolean_syntax[4])
91 #define FTB_LBRcxx . . $ `storage/maria/ma_ftdefs.h:91:9`! (ft_boolean_syntax[5])
92 #define FTB_RBRcxx . . $ `storage/maria/ma_ftdefs.h:92:9`! (ft_boolean_syntax[6])
93 #define FTB_NEGcxx . . $ `storage/maria/ma_ftdefs.h:93:9`! (ft_boolean_syntax[7])
94 #define FTB_TRUNCcxx . . $ `storage/maria/ma_ftdefs.h:94:9`! (ft_boolean_syntax[8])
95 #define FTB_LQUOTcxx . . $ `storage/maria/ma_ftdefs.h:95:9`! (ft_boolean_syntax[10])
96 #define FTB_RQUOTcxx . . $ `storage/maria/ma_ftdefs.h:96:9`! (ft_boolean_syntax[11])
97
98 typedef struct st_maria_ft_wordcxx . . $ st_maria_ft_word# {
99 const ucharcxx . . $ uchar# * poscxx . . $ st_maria_ft_word#pos.;
100 uintcxx . . $ uint# lencxx . . $ st_maria_ft_word#len.;
101 double weightcxx . . $ st_maria_ft_word#weight.;
102 } FT_WORDcxx . . $ FT_WORD#;
103
104 int is_stopwordcxx . . $ is_stopword(54dd70b47e85a2fc).(const char *word, size_t len);
105
106 MARIA_KEYcxx . . $ MARIA_KEY# *_ma_ft_make_keycxx . . $ _ma_ft_make_key(2bd3ae8c3f580fc8).(MARIA_HAcxx . . $ MARIA_HA# *, MARIA_KEYcxx . . $ MARIA_KEY# *, uintcxx . . $ uint# , ucharcxx . . $ uchar# *, FT_WORDcxx . . $ FT_WORD# *,
107 my_off_tcxx . . $ my_off_t#);
108
109 ucharcxx . . $ uchar# maria_ft_get_wordcxx . . $ maria_ft_get_word(eeb02146b7ede423).(CHARSET_INFOcxx . . $ CHARSET_INFO# *, const ucharcxx . . $ uchar# **, const ucharcxx . . $ uchar# *,
110 FT_WORDcxx . . $ FT_WORD# *, MYSQL_FTPARSER_BOOLEAN_INFOcxx . . $ MYSQL_FTPARSER_BOOLEAN_INFO# *);
111 ucharcxx . . $ uchar# maria_ft_simple_get_wordcxx . . $ maria_ft_simple_get_word(36d2b3c9fb6f5849).(CHARSET_INFOcxx . . $ CHARSET_INFO# *, ucharcxx . . $ uchar# **, const ucharcxx . . $ uchar# *,
112 FT_WORDcxx . . $ FT_WORD# *, my_boolcxx . . $ my_bool#);
113
114 typedef struct _st_maria_ft_seg_iteratorcxx . . $ _st_maria_ft_seg_iterator# {
115 uintcxx . . $ uint# numcxx . . $ _st_maria_ft_seg_iterator#num., lencxx . . $ _st_maria_ft_seg_iterator#len.;
116 HA_KEYSEGcxx . . $ HA_KEYSEG# *segcxx . . $ _st_maria_ft_seg_iterator#seg.;
117 const ucharcxx . . $ uchar# *reccxx . . $ _st_maria_ft_seg_iterator#rec., *poscxx . . $ _st_maria_ft_seg_iterator#pos.;
118 } FT_SEG_ITERATORcxx . . $ FT_SEG_ITERATOR#;
119
120 void _ma_ft_segiterator_initcxx . . $ _ma_ft_segiterator_init(23bbe8ce94c56f23).(MARIA_HAcxx . . $ MARIA_HA# *, uintcxx . . $ uint#, const ucharcxx . . $ uchar# *, FT_SEG_ITERATORcxx . . $ FT_SEG_ITERATOR# *);
121 void _ma_ft_segiterator_dummy_initcxx . . $ _ma_ft_segiterator_dummy_init(4e4646f085b798bc).(const ucharcxx . . $ uchar# *, uintcxx . . $ uint#, FT_SEG_ITERATORcxx . . $ FT_SEG_ITERATOR# *);
122 uintcxx . . $ uint# _ma_ft_segiteratorcxx . . $ _ma_ft_segiterator(bddb26bdff806093).(FT_SEG_ITERATORcxx . . $ FT_SEG_ITERATOR# *);
123
124 void maria_ft_parse_initcxx . . $ maria_ft_parse_init(9367f67720418092).(TREEcxx . . $ TREE# *, CHARSET_INFOcxx . . $ CHARSET_INFO# *);
125 int maria_ft_parsecxx . . $ maria_ft_parse(3564f3f25aa2d3ec).(TREEcxx . . $ TREE# *, ucharcxx . . $ uchar# *, int, struct st_mysql_ftparsercxx . . $ st_mysql_ftparser# *parser,
126 MYSQL_FTPARSER_PARAMcxx . . $ MYSQL_FTPARSER_PARAM# *, MEM_ROOTcxx . . $ MEM_ROOT# *);
127 FT_WORDcxx . . $ FT_WORD# * maria_ft_linearizecxx . . $ maria_ft_linearize(9f3cf8a7610790a5).(TREEcxx . . $ TREE# *, MEM_ROOTcxx . . $ MEM_ROOT# *);
128 FT_WORDcxx . . $ FT_WORD# * _ma_ft_parserecordcxx . . $ _ma_ft_parserecord(b7da9fbb0197f2e4).(MARIA_HAcxx . . $ MARIA_HA# *, uintcxx . . $ uint#, const ucharcxx . . $ uchar# *, MEM_ROOTcxx . . $ MEM_ROOT# *);
129 uintcxx . . $ uint# _ma_ft_parsecxx . . $ _ma_ft_parse(e90798e5275ee0ee).(TREEcxx . . $ TREE# *, MARIA_HAcxx . . $ MARIA_HA# *, uintcxx . . $ uint#, const ucharcxx . . $ uchar# *,
130 MYSQL_FTPARSER_PARAMcxx . . $ MYSQL_FTPARSER_PARAM# *, MEM_ROOTcxx . . $ MEM_ROOT# *);
131
132 FT_INFOcxx . . $ FT_INFO# *maria_ft_init_nlq_searchcxx . . $ maria_ft_init_nlq_search(4fe121f337083f0a).(MARIA_HAcxx . . $ MARIA_HA# *, uintcxx . . $ uint#, ucharcxx . . $ uchar# *, uintcxx . . $ uint#, uintcxx . . $ uint#,
133 ucharcxx . . $ uchar# *);
134 FT_INFOcxx . . $ FT_INFO# *maria_ft_init_boolean_searchcxx . . $ maria_ft_init_boolean_search(21c845a1ccadaa01).(MARIA_HAcxx . . $ MARIA_HA# *, uintcxx . . $ uint#, ucharcxx . . $ uchar# *, uintcxx . . $ uint#,
135 CHARSET_INFOcxx . . $ CHARSET_INFO# *);
136
137 extern const struct _ft_vftcxx . . $ _ft_vft# _ma_ft_vft_nlqcxx . . $ _ma_ft_vft_nlq.;
138 int maria_ft_nlq_read_nextcxx . . $ maria_ft_nlq_read_next(87e99b18837fe387).(FT_INFOcxx . . $ FT_INFO# *, char *);
139 float maria_ft_nlq_find_relevancecxx . . $ maria_ft_nlq_find_relevance(7449771d60404249).(FT_INFOcxx . . $ FT_INFO# *, ucharcxx . . $ uchar# *, uintcxx . . $ uint#);
140 void maria_ft_nlq_close_searchcxx . . $ maria_ft_nlq_close_search(bb1b7940d4ba8068).(FT_INFOcxx . . $ FT_INFO# *);
141 float maria_ft_nlq_get_relevancecxx . . $ maria_ft_nlq_get_relevance(ca36cf81b4b9c870).(FT_INFOcxx . . $ FT_INFO# *);
142 my_off_tcxx . . $ my_off_t# maria_ft_nlq_get_docidcxx . . $ maria_ft_nlq_get_docid(b1fb8a25939bfcf9).(FT_INFOcxx . . $ FT_INFO# *);
143 void maria_ft_nlq_reinit_searchcxx . . $ maria_ft_nlq_reinit_search(bb1b7940d4ba8068).(FT_INFOcxx . . $ FT_INFO# *);
144
145 extern const struct _ft_vftcxx . . $ _ft_vft# _ma_ft_vft_booleancxx . . $ _ma_ft_vft_boolean.;
146 int maria_ft_boolean_read_nextcxx . . $ maria_ft_boolean_read_next(87e99b18837fe387).(FT_INFOcxx . . $ FT_INFO# *, char *);
147 float maria_ft_boolean_find_relevancecxx . . $ maria_ft_boolean_find_relevance(7449771d60404249).(FT_INFOcxx . . $ FT_INFO# *, ucharcxx . . $ uchar# *, uintcxx . . $ uint#);
148 void maria_ft_boolean_close_searchcxx . . $ maria_ft_boolean_close_search(bb1b7940d4ba8068).(FT_INFOcxx . . $ FT_INFO# *);
149 float maria_ft_boolean_get_relevancecxx . . $ maria_ft_boolean_get_relevance(ca36cf81b4b9c870).(FT_INFOcxx . . $ FT_INFO# *);
150 my_off_tcxx . . $ my_off_t# maria_ft_boolean_get_docidcxx . . $ maria_ft_boolean_get_docid(b1fb8a25939bfcf9).(FT_INFOcxx . . $ FT_INFO# *);
151 void maria_ft_boolean_reinit_searchcxx . . $ maria_ft_boolean_reinit_search(bb1b7940d4ba8068).(FT_INFOcxx . . $ FT_INFO# *);
152 MYSQL_FTPARSER_PARAMcxx . . $ MYSQL_FTPARSER_PARAM#* maria_ftparser_alloc_paramcxx . . $ maria_ftparser_alloc_param(6934b2def82bb4bc).(MARIA_HAcxx . . $ MARIA_HA# *info);
153 extern MYSQL_FTPARSER_PARAMcxx . . $ MYSQL_FTPARSER_PARAM# *maria_ftparser_call_initializercxx . . $ maria_ftparser_call_initializer(5944519eb5ff35ce).(MARIA_HAcxx . . $ MARIA_HA# *info,
154 uintcxx . . $ uint# keynr,
155 uintcxx . . $ uint# paramnr);
156 extern void maria_ftparser_call_deinitializercxx . . $ maria_ftparser_call_deinitializer(1e8279855a45f04d).(MARIA_HAcxx . . $ MARIA_HA# *info);