summaryrefslogtreecommitdiff
path: root/storage/innobase/include/fts0ast.h
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/include/fts0ast.h')
-rw-r--r--storage/innobase/include/fts0ast.h53
1 files changed, 41 insertions, 12 deletions
diff --git a/storage/innobase/include/fts0ast.h b/storage/innobase/include/fts0ast.h
index 50f62063893..f0f00a40193 100644
--- a/storage/innobase/include/fts0ast.h
+++ b/storage/innobase/include/fts0ast.h
@@ -26,8 +26,16 @@ Created 2007/03/16/03 Sunny Bains
#ifndef INNOBASE_FST0AST_H
#define INNOBASE_FST0AST_H
-#include "mem0mem.h"
#include "ha_prototypes.h"
+#include "mem0mem.h"
+
+#ifdef UNIV_PFS_MEMORY
+
+#define malloc(A) ut_malloc_nokey(A)
+#define free(A) ut_free(A)
+#define realloc(P, A) ut_realloc(P, A)
+
+#endif /* UNIV_PFS_MEMORY */
/* The type of AST Node */
enum fts_ast_type_t {
@@ -35,6 +43,10 @@ enum fts_ast_type_t {
FTS_AST_NUMB, /*!< Number */
FTS_AST_TERM, /*!< Term (or word) */
FTS_AST_TEXT, /*!< Text string */
+ FTS_AST_PARSER_PHRASE_LIST, /*!< Phase for plugin parser
+ The difference from text type
+ is that we tokenize text into
+ term list */
FTS_AST_LIST, /*!< Expression list */
FTS_AST_SUBEXP_LIST /*!< Sub-Expression list */
};
@@ -139,9 +151,8 @@ fts_ast_term_set_wildcard(
fts_ast_node_t* node); /*!< in: term to change */
/********************************************************************
Set the proximity attribute of a text node. */
-
void
-fts_ast_term_set_distance(
+fts_ast_text_set_distance(
/*======================*/
fts_ast_node_t* node, /*!< in/out: text node */
ulint distance); /*!< in: the text proximity
@@ -149,7 +160,6 @@ fts_ast_term_set_distance(
/********************************************************************//**
Free a fts_ast_node_t instance.
@return next node to free */
-UNIV_INTERN
fts_ast_node_t*
fts_ast_free_node(
/*==============*/
@@ -188,7 +198,6 @@ fts_ast_state_free(
/******************************************************************//**
Traverse the AST - in-order traversal.
@return DB_SUCCESS if all went well */
-UNIV_INTERN
dberr_t
fts_ast_visit(
/*==========*/
@@ -206,7 +215,6 @@ 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.
@return DB_SUCCESS if all went well */
-UNIV_INTERN
dberr_t
fts_ast_visit_sub_exp(
/*==================*/
@@ -216,7 +224,6 @@ fts_ast_visit_sub_exp(
MY_ATTRIBUTE((nonnull, warn_unused_result));
/********************************************************************
Create a lex instance.*/
-UNIV_INTERN
fts_lexer_t*
fts_lexer_create(
/*=============*/
@@ -226,7 +233,6 @@ fts_lexer_create(
MY_ATTRIBUTE((nonnull, malloc, warn_unused_result));
/********************************************************************
Free an fts_lexer_t instance.*/
-UNIV_INTERN
void
fts_lexer_free(
/*===========*/
@@ -240,7 +246,6 @@ has one more byte than len
@param[in] str pointer to string
@param[in] len length of the string
@return ast string with NUL-terminator */
-UNIV_INTERN
fts_ast_string_t*
fts_ast_string_create(
const byte* str,
@@ -249,7 +254,6 @@ fts_ast_string_create(
/**
Free an ast string instance
@param[in,out] ast_str string to free */
-UNIV_INTERN
void
fts_ast_string_free(
fts_ast_string_t* ast_str);
@@ -259,7 +263,6 @@ Translate ast string of type FTS_AST_NUMB to unsigned long by strtoul
@param[in] str string to translate
@param[in] base the base
@return translated number */
-UNIV_INTERN
ulint
fts_ast_string_to_ul(
const fts_ast_string_t* ast_str,
@@ -268,7 +271,6 @@ fts_ast_string_to_ul(
/**
Print the ast string
@param[in] str string to print */
-UNIV_INTERN
void
fts_ast_string_print(
const fts_ast_string_t* ast_str);
@@ -314,6 +316,9 @@ struct fts_ast_node_t {
fts_ast_node_t* next_alloc; /*!< For tracking allocations */
bool visited; /*!< whether this node is
already processed */
+ /* Used by plugin parser */
+ fts_ast_node_t* up_node; /*!< Direct up node */
+ bool go_up; /*!< Flag if go one level up */
};
/* To track state during parsing */
@@ -327,8 +332,32 @@ struct fts_ast_state_t {
fts_lexer_t* lexer; /*!< Lexer callback + arg */
CHARSET_INFO* charset; /*!< charset used for
tokenization */
+ /* Used by plugin parser */
+ fts_ast_node_t* cur_node; /*!< Current node into which
+ we add new node */
+ int depth; /*!< Depth of parsing state */
};
+/******************************************************************//**
+Create an AST term node, makes a copy of ptr for plugin parser
+@return node */
+extern
+fts_ast_node_t*
+fts_ast_create_node_term_for_parser(
+/*==========i=====================*/
+ void* arg, /*!< in: ast state */
+ const char* ptr, /*!< in: term string */
+ const ulint len); /*!< in: term string length */
+
+/******************************************************************//**
+Create an AST phrase list node for plugin parser
+@return node */
+extern
+fts_ast_node_t*
+fts_ast_create_node_phrase_list(
+/*============================*/
+ void* arg); /*!< in: ast state */
+
#ifdef UNIV_DEBUG
const char*
fts_ast_oper_name_get(fts_ast_oper_t oper);