9
3

ft_global.h 3.0 KB

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