MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fts0ast.h File Reference
#include "mem0mem.h"
#include "ha_prototypes.h"
Include dependency graph for fts0ast.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fts_ast_term_t
struct  fts_ast_text_t
struct  fts_ast_list_t
struct  fts_ast_node_t
struct  fts_ast_state_t

Typedefs

typedef dberr_t(* fts_ast_callback )(fts_ast_oper_t, fts_ast_node_t *, void *)

Enumerations

enum  fts_ast_type_t {
  FTS_AST_OPER, FTS_AST_NUMB, FTS_AST_TERM, FTS_AST_TEXT,
  FTS_AST_LIST, FTS_AST_SUBEXP_LIST
}
enum  fts_ast_oper_t {
  FTS_NONE, FTS_IGNORE, FTS_EXIST, FTS_NEGATE,
  FTS_INCR_RATING, FTS_DECR_RATING, FTS_DISTANCE, FTS_IGNORE_SKIP,
  FTS_EXIST_SKIP
}

Functions

int fts_parse (fts_ast_state_t *state)
fts_ast_node_tfts_ast_create_node_oper (void *arg, fts_ast_oper_t oper)
fts_ast_node_tfts_ast_create_node_term (void *arg, const char *ptr)
fts_ast_node_tfts_ast_create_node_text (void *arg, const char *ptr)
fts_ast_node_tfts_ast_create_node_list (void *arg, fts_ast_node_t *expr)
fts_ast_node_tfts_ast_create_node_subexp_list (void *arg, fts_ast_node_t *expr)
void fts_ast_term_set_wildcard (fts_ast_node_t *node)
void fts_ast_term_set_distance (fts_ast_node_t *node, ulint distance)
UNIV_INTERN fts_ast_node_tfts_ast_free_node (fts_ast_node_t *node)
fts_ast_node_tfts_ast_add_node (fts_ast_node_t *list, fts_ast_node_t *node)
void fts_ast_node_print (fts_ast_node_t *node)
void fts_ast_state_add_node (fts_ast_state_t *state, fts_ast_node_t *node)
void fts_ast_state_free (fts_ast_state_t *state)
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) __attribute__((nonnull
UNIV_INTERN dberr_t fts_ast_visit_sub_exp (fts_ast_node_t *node, fts_ast_callback visitor, void *arg) __attribute__((nonnull
UNIV_INTERN fts_lexer_tfts_lexer_create (ibool boolean_mode, const byte *query, ulint query_len) __attribute__((nonnull
UNIV_INTERN void fts_lexer_free (fts_lexer_t *fts_lexer) __attribute__((nonnull))

Variables

UNIV_INTERN dberr_t warn_unused_result
UNIV_INTERN fts_lexer_t malloc

Detailed Description

The FTS query parser (AST) abstract syntax tree routines

Created 2007/03/16/03 Sunny Bains

Definition in file fts0ast.h.

Enumeration Type Documentation

Enumerator:
FTS_NONE 

No operator

FTS_IGNORE 

Ignore rows that contain this word

FTS_EXIST 

Include rows that contain this word

FTS_NEGATE 

Include rows that contain this word but rank them lower

FTS_INCR_RATING 

Increase the rank for this word

FTS_DECR_RATING 

Decrease the rank for this word

FTS_DISTANCE 

Proximity distance

FTS_IGNORE_SKIP 

Transient node operator signifies that this is a FTS_IGNORE node, and ignored in the first pass of fts_ast_visit()

FTS_EXIST_SKIP 

Transient node operator signifies that this ia a FTS_EXIST node, and ignored in the first pass of fts_ast_visit()

Definition at line 43 of file fts0ast.h.

Enumerator:
FTS_AST_OPER 

Operator

FTS_AST_NUMB 

Number

FTS_AST_TERM 

Term (or word)

FTS_AST_TEXT 

Text string

FTS_AST_LIST 

Expression list

FTS_AST_SUBEXP_LIST 

Sub-Expression list

Definition at line 33 of file fts0ast.h.

Function Documentation

fts_ast_node_t* fts_ast_add_node ( fts_ast_node_t node,
fts_ast_node_t elem 
)

in: (sub) expr to add

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:

fts_ast_node_t* fts_ast_create_node_list ( void *  arg,
fts_ast_node_t expr 
)

in: ast 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:

fts_ast_node_t* fts_ast_create_node_oper ( void *  arg,
fts_ast_oper_t  oper 
)

in: ast operator

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:

fts_ast_node_t* fts_ast_create_node_subexp_list ( void *  arg,
fts_ast_node_t expr 
)

in: ast expr instance

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:

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

in: term string

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:

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

in: text string

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 in: node to free

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:

void fts_ast_node_print ( fts_ast_node_t node)

in: ast node to print

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:

void fts_ast_state_add_node ( fts_ast_state_t state,
fts_ast_node_t node 
)

in: node to add to state

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:

void fts_ast_state_free ( fts_ast_state_t state)

in: state instance to free

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:

void fts_ast_term_set_distance ( fts_ast_node_t node,
ulint  distance 
)

in: the text proximity 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.

void fts_ast_term_set_wildcard ( fts_ast_node_t node)

in: term to change

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.

Returns
DB_SUCCESS if all went well
Parameters
operin: FTS operator
nodein: instance to traverse
visitorin: callback
argin: callback arg
has_ignoreout: whether we encounter and ignored processing an operator, currently we only ignore FTS_IGNORE operator
UNIV_INTERN dberr_t fts_ast_visit_sub_exp ( fts_ast_node_t node,
fts_ast_callback  visitor,
void *  arg 
)

Process (nested) sub-expression, create a new result set to store the sub-expression result by processing nodes under current sub-expression list. Merge the sub-expression result with that of parent expression list.

Returns
DB_SUCCESS if all went well
Parameters
nodein: instance to traverse
visitorin: callback
argin: callback arg

Here is the caller graph for this function:

UNIV_INTERN fts_lexer_t* fts_lexer_create ( ibool  boolean_mode,
const byte *  query,
ulint  query_len 
)
Parameters
boolean_modein: query type
queryin: query string
query_lenin: query string len
UNIV_INTERN void fts_lexer_free ( fts_lexer_t fts_lexer)
Parameters
fts_lexerin: lexer instance to free
int fts_parse ( fts_ast_state_t state)

in: ast state instance.