1/* Copyright (c) 2000-2005, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
2 Use is subject to license terms.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; version 2 of the License.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
16
17/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
18
19/* some definitions for full-text indices */
20
21/* #include "myisam.h" */
22
23#ifndef _ft_global_h
24#define _ft_global_h
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#include <my_compare.h>
30
31#define HA_FT_MAXBYTELEN 254
32#define HA_FT_MAXCHARLEN (HA_FT_MAXBYTELEN/3)
33
34#define DEFAULT_FTB_SYNTAX "+ -><()~*:\"\"&|"
35
36typedef struct st_ft_info FT_INFO;
37struct _ft_vft
38{
39 int (*read_next)(FT_INFO *, char *);
40 float (*find_relevance)(FT_INFO *, uchar *, uint);
41 void (*close_search)(FT_INFO *);
42 float (*get_relevance)(FT_INFO *);
43 void (*reinit_search)(FT_INFO *);
44};
45
46typedef struct st_ft_info_ext FT_INFO_EXT;
47struct _ft_vft_ext
48{
49 uint (*get_version)(); // Extended API version
50 ulonglong (*get_flags)();
51 ulonglong (*get_docid)(FT_INFO_EXT *);
52 ulonglong (*count_matches)(FT_INFO_EXT *);
53};
54
55/* Flags for extended FT API */
56#define FTS_ORDERED_RESULT (1LL << 1)
57#define FTS_DOCID_IN_RESULT (1LL << 2)
58
59#define FTS_DOC_ID_COL_NAME "FTS_DOC_ID"
60
61#ifndef FT_CORE
62struct st_ft_info
63{
64 struct _ft_vft *please; /* INTERCAL style :-) */
65};
66
67struct st_ft_info_ext
68{
69 struct _ft_vft *please; /* INTERCAL style :-) */
70 struct _ft_vft_ext *could_you;
71};
72#endif
73
74extern const char *ft_stopword_file;
75extern const char *ft_precompiled_stopwords[];
76
77extern ulong ft_min_word_len;
78extern ulong ft_max_word_len;
79extern ulong ft_query_expansion_limit;
80extern const char *ft_boolean_syntax;
81extern struct st_mysql_ftparser ft_default_parser;
82
83int ft_init_stopwords(void);
84void ft_free_stopwords(void);
85
86#define FT_NL 0
87#define FT_BOOL 1
88#define FT_SORTED 2
89#define FT_EXPAND 4 /* query expansion */
90
91FT_INFO *ft_init_search(uint,void *, uint, uchar *, size_t,
92 CHARSET_INFO *, uchar *);
93my_bool ft_boolean_check_syntax_string(const uchar *);
94
95/* Internal symbols for fulltext between maria and MyISAM */
96
97#define HA_FT_WTYPE HA_KEYTYPE_FLOAT
98#define HA_FT_WLEN 4
99#define FT_SEGS 2
100
101#define ft_sintXkorr(A) mi_sint4korr(A)
102#define ft_intXstore(T,A) mi_int4store(T,A)
103
104extern const HA_KEYSEG ft_keysegs[FT_SEGS];
105
106typedef union {int32 i; float f;} FT_WEIGTH;
107
108#ifdef __cplusplus
109}
110#endif
111#endif
112