MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fts0ast.cc File Reference
#include "mem0mem.h"
#include "fts0ast.h"
#include "fts0pars.h"
#include "fts0fts.h"
Include dependency graph for fts0ast.cc:

Go to the source code of this file.

Enumerations

enum  fts_ast_visit_pass_t { FTS_PASS_FIRST, FTS_PASS_EXIST, FTS_PASS_IGNORE }

Functions

UNIV_INTERN fts_ast_node_tfts_ast_create_node_oper (void *arg, fts_ast_oper_t oper)
UNIV_INTERN fts_ast_node_tfts_ast_create_node_term (void *arg, const char *ptr)
UNIV_INTERN fts_ast_node_tfts_ast_create_node_text (void *arg, const char *ptr)
UNIV_INTERN fts_ast_node_tfts_ast_create_node_list (void *arg, fts_ast_node_t *expr)
UNIV_INTERN fts_ast_node_tfts_ast_create_node_subexp_list (void *arg, fts_ast_node_t *expr)
UNIV_INTERN fts_ast_node_tfts_ast_free_node (fts_ast_node_t *node)
UNIV_INTERN fts_ast_node_tfts_ast_add_node (fts_ast_node_t *node, fts_ast_node_t *elem)
UNIV_INTERN void fts_ast_state_add_node (fts_ast_state_t *state, fts_ast_node_t *node)
UNIV_INTERN void fts_ast_term_set_wildcard (fts_ast_node_t *node)
UNIV_INTERN void fts_ast_term_set_distance (fts_ast_node_t *node, ulint distance)
UNIV_INTERN void fts_ast_state_free (fts_ast_state_t *state)
UNIV_INTERN void fts_ast_node_print (fts_ast_node_t *node)
UNIV_INTERN dberr_t fts_ast_visit (fts_ast_oper_t oper, fts_ast_node_t *node, fts_ast_callback visitor, void *arg, bool *has_ignore)

Detailed Description

Full Text Search parser helper file.

Created 2007/3/16 Sunny Bains.

Definition in file fts0ast.cc.

Enumeration Type Documentation

Enumerator:
FTS_PASS_FIRST 

First visit pass, process operators excluding FTS_EXIST and FTS_IGNORE

FTS_PASS_EXIST 

Exist visit pass, process operator FTS_EXIST

FTS_PASS_IGNORE 

Ignore visit pass, process operator FTS_IGNORE

Definition at line 32 of file fts0ast.cc.

Function Documentation

UNIV_INTERN fts_ast_node_t* fts_ast_add_node ( fts_ast_node_t node,
fts_ast_node_t elem 
)

This AST takes ownership of the expr and is responsible for free'ing it.

Returns
in param "list"
Parameters
nodein: list instance
elemin: node to add to list

Definition at line 315 of file fts0ast.cc.

Here is the caller graph for this function:

UNIV_INTERN fts_ast_node_t* fts_ast_create_node_list ( void *  arg,
fts_ast_node_t expr 
)

This function takes ownership of the expr and is responsible for free'ing it.

Returns
new node
Parameters
argin: ast state instance
exprin: ast expr instance

Definition at line 207 of file fts0ast.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN fts_ast_node_t* fts_ast_create_node_oper ( void *  arg,
fts_ast_oper_t  oper 
)

Create a operator fts_ast_node_t.

Returns
new node
Parameters
argin: ast state instance
operin: ast operator

Definition at line 63 of file fts0ast.cc.

Here is the call graph for this function:

UNIV_INTERN fts_ast_node_t* fts_ast_create_node_subexp_list ( void *  arg,
fts_ast_node_t expr 
)

Create a sub-expression list node. This function takes ownership of expr and is responsible for deleting it.

Returns
new node
Parameters
argin: ast state instance
exprin: ast expr instance

Definition at line 228 of file fts0ast.cc.

Here is the call graph for this function:

UNIV_INTERN fts_ast_node_t* fts_ast_create_node_term ( void *  arg,
const char *  ptr 
)

This function takes ownership of the ptr and is responsible for free'ing it

Returns
new node or a node list with tokenized words
Parameters
argin: ast state instance
ptrin: ast term string

Definition at line 84 of file fts0ast.cc.

Here is the call graph for this function:

UNIV_INTERN fts_ast_node_t* fts_ast_create_node_text ( void *  arg,
const char *  ptr 
)

This function takes ownership of the ptr and is responsible for free'ing it.

Returns
new node

< We ignore the actual quotes ""

< Skip copying the first quote

Parameters
argin: ast state instance
ptrin: ast text string

Definition at line 159 of file fts0ast.cc.

Here is the call graph for this function:

UNIV_INTERN fts_ast_node_t* fts_ast_free_node ( fts_ast_node_t node)

Free a fts_ast_node_t instance.

Returns
next node to free
Parameters
nodein: the node to free

Definition at line 267 of file fts0ast.cc.

Here is the call graph for this function:

UNIV_INTERN void fts_ast_node_print ( fts_ast_node_t node)

Print an ast node.

Parameters
nodein: ast node to print

Definition at line 436 of file fts0ast.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void fts_ast_state_add_node ( fts_ast_state_t state,
fts_ast_node_t node 
)

For tracking node allocations, in case there is an error during parsing.

Parameters
statein: ast instance
nodein: node to add to ast

Definition at line 347 of file fts0ast.cc.

Here is the caller graph for this function:

UNIV_INTERN void fts_ast_state_free ( fts_ast_state_t state)

Free node and expr allocations.

Parameters
statein: ast state to free

Definition at line 407 of file fts0ast.cc.

Here is the call graph for this function:

UNIV_INTERN void fts_ast_term_set_distance ( fts_ast_node_t node,
ulint  distance 
)

Set the proximity attribute of a text node.

Parameters
nodein/out: text node
distancein: the text proximity distance

Definition at line 391 of file fts0ast.cc.

UNIV_INTERN void fts_ast_term_set_wildcard ( fts_ast_node_t node)

Set the wildcard attribute of a term.

Parameters
nodein/out: set attribute of a term node

Definition at line 366 of file fts0ast.cc.

UNIV_INTERN dberr_t fts_ast_visit ( fts_ast_oper_t  oper,
fts_ast_node_t node,
fts_ast_callback  visitor,
void *  arg,
bool *  has_ignore 
)

Traverse the AST - in-order traversal, except for the FTX_EXIST and FTS_IGNORE nodes, which will be ignored in the first pass of each level, and visited in a second and third pass after all other nodes in the same level are visited.

Returns
DB_SUCCESS if all went well
Parameters
operin: current operator
nodein: current root node
visitorin: callback function
argin: arg for callback
has_ignoreout: true, if the operator was ignored during processing, currently we ignore FTS_EXIST and FTS_IGNORE operators

Definition at line 483 of file fts0ast.cc.

Here is the call graph for this function: