MySQL 8.0.40
Source Code Documentation
plugin_mecab.cc File Reference
#include "my_config.h"
#include "my_compiler.h"
#include <assert.h>
#include <mecab.h>
#include <string>
#include <mysql/components/my_service.h>
#include <mysql/components/services/log_builtins.h>
#include "mysqld_error.h"
#include "storage/innobase/include/fts0tokenize.h"

Functions

static bool mecab_parser_check_and_set_charset (const char *charset)
 Set MeCab parser charset. More...
 
static int mecab_parser_plugin_init (void *)
 MeCab parser plugin initialization. More...
 
static int mecab_parser_plugin_deinit (void *)
 MeCab parser plugin deinit. More...
 
static int mecab_parse (MeCab::Lattice *mecab_lattice, MYSQL_FTPARSER_PARAM *param, char *doc, int len, MYSQL_FTPARSER_BOOLEAN_INFO *bool_info)
 Parse a document by MeCab. More...
 
static int mecab_parser_parse (MYSQL_FTPARSER_PARAM *param)
 MeCab parser parse a document. More...
 
static MYSQL_SYSVAR_STR (rc_file, mecab_rc_file, PLUGIN_VAR_READONLY|PLUGIN_VAR_NOPERSIST, "MECABRC file path", NULL, NULL, NULL)
 
 mysql_declare_plugin (mecab_parser)
 

Variables

static MeCab::Model * mecab_model = NULL
 Global mecab objects shared by all threads. More...
 
static MeCab::Tagger * mecab_tagger = NULL
 
static char mecab_charset [64]
 Mecab charset. More...
 
static char * mecab_rc_file
 Mecab rc file path. More...
 
static const char * mecab_min_supported_version = "0.993"
 
static const char * mecab_max_supported_version = "0.996"
 
static const mysql_service_registry_treg_srv = nullptr
 
const mysql_service_log_builtins_tlog_bi = nullptr
 accessor built-ins More...
 
const mysql_service_log_builtins_string_tlog_bs = nullptr
 string built-ins More...
 
static struct st_mysql_ftparser mecab_parser_descriptor
 Fulltext MeCab Parser Descriptor. More...
 
static SHOW_VAR mecab_status []
 
static SYS_VARmecab_system_variables [] = {MYSQL_SYSVAR(rc_file), NULL}
 
 mysql_declare_plugin_end
 

Function Documentation

◆ mecab_parse()

static int mecab_parse ( MeCab::Lattice *  mecab_lattice,
MYSQL_FTPARSER_PARAM param,
char *  doc,
int  len,
MYSQL_FTPARSER_BOOLEAN_INFO bool_info 
)
static

Parse a document by MeCab.

Parameters
[in]mecab_latticemecab lattice
[in]paramplugin parser param
[in]docdocument to parse
[in]lendocument length
[in,out]bool_infoboolean info
Return values
0on success
1on failure.

◆ mecab_parser_check_and_set_charset()

static bool mecab_parser_check_and_set_charset ( const char *  charset)
static

Set MeCab parser charset.

Parameters
[in]charsetcharset string
Return values
trueon success
falseon failure

◆ mecab_parser_parse()

static int mecab_parser_parse ( MYSQL_FTPARSER_PARAM param)
static

MeCab parser parse a document.

Parameters
[in]paramplugin parser param
Return values
0on success
1on failure.

◆ mecab_parser_plugin_deinit()

static int mecab_parser_plugin_deinit ( void *  )
static

MeCab parser plugin deinit.

Return values
0

◆ mecab_parser_plugin_init()

static int mecab_parser_plugin_init ( void *  )
static

MeCab parser plugin initialization.

Return values
0on success
1on failure.

◆ mysql_declare_plugin()

mysql_declare_plugin ( mecab_parser  )

< type

< descriptor

< name

< author

< description

< license

< init function (when loaded)

< check uninstall function

< deinit function (when unloaded)

< version

< status variables

< system variables

◆ MYSQL_SYSVAR_STR()

static MYSQL_SYSVAR_STR ( rc_file  ,
mecab_rc_file  ,
PLUGIN_VAR_READONLY PLUGIN_VAR_NOPERSIST,
"MECABRC file path ,
NULL  ,
NULL  ,
NULL   
)
static

Variable Documentation

◆ log_bi

accessor built-ins

accessor built-ins

◆ log_bs

string built-ins

◆ mecab_charset

char mecab_charset[64]
static

Mecab charset.

◆ mecab_max_supported_version

const char* mecab_max_supported_version = "0.996"
static

◆ mecab_min_supported_version

const char* mecab_min_supported_version = "0.993"
static

◆ mecab_model

MeCab::Model* mecab_model = NULL
static

Global mecab objects shared by all threads.

◆ mecab_parser_descriptor

struct st_mysql_ftparser mecab_parser_descriptor
static
Initial value:
= {
#define MYSQL_FTPARSER_INTERFACE_VERSION
Definition: plugin.h:655
static int mecab_parser_parse(MYSQL_FTPARSER_PARAM *param)
MeCab parser parse a document.
Definition: plugin_mecab.cc:248

Fulltext MeCab Parser Descriptor.

◆ mecab_rc_file

char* mecab_rc_file
static

Mecab rc file path.

◆ mecab_status

SHOW_VAR mecab_status[]
static
Initial value:
= {
static char mecab_charset[64]
Mecab charset.
Definition: plugin_mecab.cc:50
enum_mysql_show_type
Declarations for SHOW STATUS support in plugins.
Definition: status_var.h:30
@ SHOW_CHAR
Definition: status_var.h:36
@ SHOW_SCOPE_GLOBAL
Definition: status_var.h:70

◆ mecab_system_variables

SYS_VAR* mecab_system_variables[] = {MYSQL_SYSVAR(rc_file), NULL}
static

◆ mecab_tagger

MeCab::Tagger* mecab_tagger = NULL
static

◆ mysql_declare_plugin_end

mysql_declare_plugin_end

◆ reg_srv

const mysql_service_registry_t* reg_srv = nullptr
static