MySQL  8.0.19
Source Code Documentation
ft_global.h
Go to the documentation of this file.
1 #ifndef FT_GLOBAL_INCLUDED
2 #define FT_GLOBAL_INCLUDED
3 
4 /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License, version 2.0,
8  as published by the Free Software Foundation.
9 
10  This program is also distributed with certain software (including
11  but not limited to OpenSSL) that is licensed under separate terms,
12  as designated in a particular file or component or in included license
13  documentation. The authors of MySQL hereby grant you an additional
14  permission to link the program and your derivative works with the
15  separately licensed software that they have included with MySQL.
16 
17  This program is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License, version 2.0, for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with this program; if not, write to the Free Software
24  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
25 
26 /* Written by Sergei A. Golubchik, who has a shared copyright to this code */
27 
28 /**
29  @file include/ft_global.h
30  Some definitions for full-text indices.
31 */
32 
33 /* #include "myisam.h" */
34 
35 #include <sys/types.h>
36 
37 #include "m_ctype.h"
38 #include "my_base.h"
39 #include "my_inttypes.h"
40 
41 #define HA_FT_MAXBYTELEN 336
42 #define HA_FT_MAXCHARLEN (HA_FT_MAXBYTELEN / 4)
43 
44 #define DEFAULT_FTB_SYNTAX "+ -><()~*:\"\"&|"
45 
46 struct FT_INFO;
47 struct _ft_vft {
48  int (*read_next)(FT_INFO *, char *);
49  float (*find_relevance)(FT_INFO *, uchar *, uint);
50  void (*close_search)(FT_INFO *);
51  float (*get_relevance)(FT_INFO *);
52  void (*reinit_search)(FT_INFO *);
53 };
54 
55 struct FT_INFO_EXT;
56 struct _ft_vft_ext {
57  uint (*get_version)(); // Extended API version
61 };
62 
63 /* Flags for extended FT API */
64 #define FTS_ORDERED_RESULT (1LL << 1)
65 #define FTS_DOCID_IN_RESULT (1LL << 2)
66 
67 #define FTS_DOC_ID_COL_NAME "FTS_DOC_ID"
68 
69 #define FTS_NGRAM_PARSER_NAME "ngram"
70 
71 struct FT_INFO {
72  struct _ft_vft *please; /* INTERCAL style :-) */
73 };
74 
75 #ifndef FT_CORE
76 struct FT_INFO_EXT {
77  struct _ft_vft *please; /* INTERCAL style :-) */
79 };
80 #endif
81 
82 extern const char *ft_stopword_file;
83 extern const char *ft_precompiled_stopwords[];
84 
85 extern ulong ft_min_word_len;
86 extern ulong ft_max_word_len;
88 extern const char *ft_boolean_syntax;
90 
91 int ft_init_stopwords(void);
92 void ft_free_stopwords(void);
93 
94 /**
95  Operation types, used in FT_HINTS.
96 */
97 
99  FT_OP_UNDEFINED, /** Operation undefined, use of hints is impossible */
100  FT_OP_NO, /** No operation, single MATCH function */
101  FT_OP_GT, /** 'Greater than' operation */
102  FT_OP_GE /** 'Greater than or equal to' operation */
103 };
104 
105 #define FT_NL 0 /** Normal mode */
106 #define FT_BOOL 1 /** Boolean mode */
107 #define FT_SORTED 2 /** perform internal sorting by rank */
108 #define FT_EXPAND 4 /** query expansion */
109 #define FT_NO_RANKING 8 /** skip rank calculation */
110 
111 /**
112  Info about FULLTEXT index hints,
113  passed to the storage engine.
114 */
115 
116 struct ft_hints {
117  /** FULLTEXT flags, see FT_NL, etc */
119  /** Operation type */
121  /** Operation value */
122  double op_value;
123  /** LIMIT value, HA_POS_ERROR if not set */
125 };
126 
127 FT_INFO *ft_init_search(uint, void *, uint, uchar *, uint, const CHARSET_INFO *,
128  uchar *);
130 
131 #endif /* FT_GLOBAL_INCLUDED */
_ft_vft::reinit_search
void(* reinit_search)(FT_INFO *)
Definition: ft_global.h:52
my_base.h
ft_hints::flags
uint flags
FULLTEXT flags, see FT_NL, etc.
Definition: ft_global.h:118
ft_init_stopwords
int ft_init_stopwords(void)
Definition: ft_stopwords.cc:64
ft_query_expansion_limit
ulong ft_query_expansion_limit
Definition: ft_static.cc:33
CHARSET_INFO
Definition: m_ctype.h:354
ft_max_word_len
ulong ft_max_word_len
Definition: ft_static.cc:32
FT_OP_GE
@ FT_OP_GE
'Greater than' operation
Definition: ft_global.h:102
_ft_vft_ext::get_flags
ulonglong(* get_flags)()
Definition: ft_global.h:58
FT_INFO_EXT::could_you
struct _ft_vft_ext * could_you
Definition: ft_global.h:78
ft_init_search
FT_INFO * ft_init_search(uint, void *, uint, uchar *, uint, const CHARSET_INFO *, uchar *)
Definition: ft_static.cc:63
_ft_vft_ext
Definition: ft_global.h:56
_ft_vft_ext::get_docid
ulonglong(* get_docid)(FT_INFO_EXT *)
Definition: ft_global.h:59
ft_hints
Info about FULLTEXT index hints, passed to the storage engine.
Definition: ft_global.h:116
ft_precompiled_stopwords
const char * ft_precompiled_stopwords[]
Definition: ft_static.cc:75
ft_free_stopwords
void ft_free_stopwords(void)
Definition: ft_stopwords.cc:129
my_inttypes.h
ft_default_parser
struct st_mysql_ftparser ft_default_parser
Definition: ft_static.cc:631
ft_hints::limit
ha_rows limit
LIMIT value, HA_POS_ERROR if not set.
Definition: ft_global.h:124
m_ctype.h
FT_OP_GT
@ FT_OP_GT
No operation, single MATCH function.
Definition: ft_global.h:101
ft_stopword_file
const char * ft_stopword_file
Definition: ft_static.cc:74
_ft_vft_ext::count_matches
ulonglong(* count_matches)(FT_INFO_EXT *)
Definition: ft_global.h:60
FT_OP_NO
@ FT_OP_NO
Operation undefined, use of hints is impossible.
Definition: ft_global.h:100
uint
unsigned int uint
Definition: uca-dump.cc:29
FT_OP_UNDEFINED
@ FT_OP_UNDEFINED
Definition: ft_global.h:99
uchar
unsigned char uchar
Definition: my_inttypes.h:51
_ft_vft_ext::get_version
uint(* get_version)()
Definition: ft_global.h:57
_ft_vft::close_search
void(* close_search)(FT_INFO *)
Definition: ft_global.h:50
ft_boolean_syntax
const char * ft_boolean_syntax
Definition: ft_static.cc:34
_ft_vft::find_relevance
float(* find_relevance)(FT_INFO *, uchar *, uint)
Definition: ft_global.h:49
ft_min_word_len
ulong ft_min_word_len
Definition: ft_static.cc:31
st_mysql_ftparser
Definition: plugin_ftparser.h:211
ft_hints::op_type
enum ft_operation op_type
Operation type.
Definition: ft_global.h:120
FT_INFO_EXT::please
struct _ft_vft * please
Definition: ft_global.h:77
ft_operation
ft_operation
Operation types, used in FT_HINTS.
Definition: ft_global.h:98
FT_INFO::please
struct _ft_vft * please
Definition: ft_global.h:72
_ft_vft
Definition: ft_global.h:47
FT_INFO_EXT
Definition: ft_global.h:76
ft_boolean_check_syntax_string
bool ft_boolean_check_syntax_string(const uchar *)
Definition: ft_parser.cc:93
ulong
unsigned long ulong
Definition: my_inttypes.h:48
ulonglong
unsigned long long int ulonglong
Definition: my_inttypes.h:55
ha_rows
my_off_t ha_rows
Definition: my_base.h:1132
_ft_vft::get_relevance
float(* get_relevance)(FT_INFO *)
Definition: ft_global.h:51
_ft_vft::read_next
int(* read_next)(FT_INFO *, char *)
Definition: ft_global.h:48
ft_hints::op_value
double op_value
Operation value.
Definition: ft_global.h:122
FT_INFO
Definition: ft_global.h:71