For the complete documentation index, see llms.txt. This page is also available as Markdown.

Full-Text Parser Plugin

Plugin API reference: Full-Text Parser Plugin. Generated from the MariaDB server headers by doxygen and moxygen.

Plugin API / Plugin Types

API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN)

Classes

Name
Description

Structure for boolean mode search.

An argument of the full-text parser plugin.

Macros


MYSQL_FTPARSER_INTERFACE_VERSION

#define MYSQL_FTPARSER_INTERFACE_VERSION 0x0100

Defined in plugin_ftparser.h:31


MYSQL_FTFLAGS_NEED_COPY

#define MYSQL_FTFLAGS_NEED_COPY 1

Defined in plugin_ftparser.h:159

Needs a copy flag.

The following flag means that buffer with a string (document, word) may be overwritten by the caller before the end of the parsing (that is before st_mysql_ftparser::deinit() call). If one needs the string to survive between two successive calls of the parsing function, she needs to save a copy of it. The flag may be set by MySQL before calling st_mysql_ftparser::parse(), or it may be set by a plugin before calling st_mysql_ftparser_param::mysql_parse() or st_mysql_ftparser_param::mysql_add_word().

Enumerations

Name
Description

Token types for boolean mode searching


enum_ftparser_mode

Defined in plugin_ftparser.h:34

Parsing modes. Set in MYSQL_FTPARSER_PARAM::mode

Value
Description

MYSQL_FTPARSER_SIMPLE_MODE

Fast and simple mode.

MYSQL_FTPARSER_WITH_STOPWORDS

Parse with stopwords mode.

MYSQL_FTPARSER_FULL_BOOLEAN_INFO

Parse in boolean mode.


enum_ft_token_type

Defined in plugin_ftparser.h:82

Token types for boolean mode searching

Used for the type member of MYSQL_FTPARSER_BOOLEAN_INFO struct.

Value
Description

FT_TOKEN_EOF

End of data.

FT_TOKEN_WORD

Regular word.

FT_TOKEN_LEFT_PAREN

Left parenthesis (start of group/sub-expression).

FT_TOKEN_RIGHT_PAREN

Right parenthesis (end of group/sub-expression).

FT_TOKEN_STOPWORD

Stopword.

Typedefs

Return
Name
Description

Structure for boolean mode search.

An argument of the full-text parser plugin.


MYSQL_FTPARSER_BOOLEAN_INFO

Type: struct st_mysql_ftparser_boolean_info

Defined in plugin_ftparser.h:145

Structure for boolean mode search.

This structure is used in boolean search mode only. It conveys boolean-mode metadata to the MySQL search engine for every word in the search query. A valid instance of this structure must be filled in by the plugin parser and passed as an argument in the call to mysql_add_word (the callback function in the MYSQL_FTPARSER_PARAM structure) when a query is parsed in boolean mode.


MYSQL_FTPARSER_PARAM

Type: struct st_mysql_ftparser_param

Defined in plugin_ftparser.h:231

An argument of the full-text parser plugin.

This structure is filled in by MySQL server and passed to the parsing function of the plugin as an in/out parameter.

Class Definitions

st_mysql_ftparser_boolean_info

Defined in plugin_ftparser.h:102

Structure for boolean mode search.

This structure is used in boolean search mode only. It conveys boolean-mode metadata to the MySQL search engine for every word in the search query. A valid instance of this structure must be filled in by the plugin parser and passed as an argument in the call to mysql_add_word (the callback function in the MYSQL_FTPARSER_PARAM structure) when a query is parsed in boolean mode.

Public Attributes

Return
Name
Description

The token type. Should be one of the enum_ft_token_type values.

int

Whether the word must be present for a match to occur

int

A weighting factor that determines how much a match for the word counts.

char

The sign of the word's weight in the query.

char

Corresponds to the * operator in the default setting of the ft_boolean_syntax system variable.

char

Parser state. Must be removed.

char *

Parser state. Must be removed.


type

Type: enum enum_ft_token_type

Defined in plugin_ftparser.h:105

The token type. Should be one of the enum_ft_token_type values.


yesno

Defined in plugin_ftparser.h:117

Whether the word must be present for a match to occur

  • >0 Must be present

  • <0 Must not be present

  • 0 Neither; the word is optional but its presence increases the relevance

With the default settings of the ft_boolean_syntax system variable, >0 corresponds to the '+' operator, <0 corresponds to the '-' operator, and 0 means neither operator was used.


weight_adjust

Defined in plugin_ftparser.h:125

A weighting factor that determines how much a match for the word counts.

Positive values increase, negative - decrease the relative word's importance in the query.


wasign

Defined in plugin_ftparser.h:135

The sign of the word's weight in the query.

If it's non-negative the match for the word will increase document relevance, if it's negative - decrease (the word becomes a "noise word", the less of it the better).


trunc

Defined in plugin_ftparser.h:140

Corresponds to the * operator in the default setting of the ft_boolean_syntax system variable.


prev

Defined in plugin_ftparser.h:142

Parser state. Must be removed.


quot

Defined in plugin_ftparser.h:144

Parser state. Must be removed.

st_mysql_ftparser_param

Defined in plugin_ftparser.h:167

An argument of the full-text parser plugin.

This structure is filled in by MySQL server and passed to the parsing function of the plugin as an in/out parameter.

Public Attributes

Return
Name
Description

int(*

A pointer to the built-in parser implementation of the server.

int(*

A server callback to add a new word.

void *

A generic pointer.

void *

This is set by the server.

const struct charset_info_st *

Information about the character set of the document or query string.

const char *

A pointer to the document or query string to be parsed.

int

Length of the document or query string, in bytes.

unsigned int

Flags for the parser. See also: MYSQL_FTFLAGS_NEED_COPY

The parsing mode. With boolean operators, with stopwords, or nothing. See also: enum_ftparser_mode.


mysql_parse

Defined in plugin_ftparser.h:179

A pointer to the built-in parser implementation of the server.

It's set by the server and can be used by the parser plugin to invoke the MySQL default parser. If plugin's role is to extract textual data from .doc, .pdf or .xml content, it might extract plaintext from the content, and then pass the text to the default MySQL parser to be parsed.


mysql_add_word

Defined in plugin_ftparser.h:192

A server callback to add a new word.

When parsing a document, the server sets this to point at a function that adds the word to MySQL full-text index. When parsing a search query, this function will add the new word to the list of words to search for. The boolean_info argument can be NULL for all cases except when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO. A plugin can replace this callback to post-process every parsed word before passing it to the original add_word function.


ftparser_state

Defined in plugin_ftparser.h:201

A generic pointer.

The plugin can set it to point to information to be used internally for its own purposes.


mysql_ftparam

Defined in plugin_ftparser.h:209

This is set by the server.

It is used by MySQL functions called via mysql_parse() and mysql_add_word() callback. The plugin should not modify it.


cs

Defined in plugin_ftparser.h:213

Information about the character set of the document or query string.


doc

Defined in plugin_ftparser.h:217

A pointer to the document or query string to be parsed.


length

Defined in plugin_ftparser.h:221

Length of the document or query string, in bytes.


flags

Defined in plugin_ftparser.h:225

Flags for the parser. See also: MYSQL_FTFLAGS_NEED_COPY


mode

Type: enum enum_ftparser_mode

Defined in plugin_ftparser.h:230

The parsing mode. With boolean operators, with stopwords, or nothing. See also: enum_ftparser_mode.

st_mysql_ftparser

Defined in plugin_ftparser.h:241

Public Attributes

Return
Name
Description

interface_version

Defined in plugin_ftparser.h:243


parse

Defined in plugin_ftparser.h:244


init

Defined in plugin_ftparser.h:245


deinit

Defined in plugin_ftparser.h:246

This page is licensed: GPLv2

spinner

Last updated

Was this helpful?