1 /* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
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, version 2.0,
5    as published by the Free Software Foundation.
6 
7    This program is also distributed with certain software (including
8    but not limited to OpenSSL) that is licensed under separate terms,
9    as designated in a particular file or component or in included license
10    documentation.  The authors of MySQL hereby grant you an additional
11    permission to link the program and your derivative works with the
12    separately licensed software that they have included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
22 
23 /* Written by Sergei A. Golubchik, who has a shared copyright to this code */
24 
25 /* some definitions for full-text indices */
26 
27 #include "myisamdef.h"
28 #include "ft_global.h"
29 
30 #define HA_FT_WTYPE  HA_KEYTYPE_FLOAT
31 #define HA_FT_WLEN   4
32 #define FT_SEGS      2
33 
34 /**
35   Accessor methods for the weight and the number of subkeys in a buffer.
36 
37   The weight is of float type and subkeys number is of integer type. Both
38   are stored in the same position of the buffer and the stored object is
39   identified by the sign (bit): the weight value is positive whilst the
40   number of subkeys is negative.
41 
42   In light of C's strict-aliasing rules, which roughly state that an object
43   must not be accessed through incompatible types, these methods are used to
44   avoid any problems arising from the type duality inside the buffer. The
45   values are retrieved using a character type which can access any object.
46 */
47 #define ft_sintXkorr(A)    mi_sint4korr(A)
48 #define ft_intXstore(T,A)  mi_int4store(T,A)
49 #define ft_floatXget(V,M)  mi_float4get(V,M)
50 
51 
52 extern const HA_KEYSEG ft_keysegs[FT_SEGS];
53 
54 int  _mi_ft_cmp(MI_INFO *, uint, const uchar *, const uchar *);
55 int  _mi_ft_add(MI_INFO *, uint, uchar *, const uchar *, my_off_t);
56 int  _mi_ft_del(MI_INFO *, uint, uchar *, const uchar *, my_off_t);
57 
58 uint _mi_ft_convert_to_ft2(MI_INFO *, uint, uchar *);
59 
60