Groonga
Loading...
Searching...
No Matches
token_filter.h
Go to the documentation of this file.
1/*
2 Copyright(C) 2014-2016 Brazil
3 Copyright(C) 2018 Kouhei Sutou <kou@clear-code.com>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19
20#pragma once
21
22#include <groonga/tokenizer.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif /* __cplusplus */
27
28/* Deprecated since 8.0.9. Use grn_token_filter_init_query_func instead. */
30 grn_obj *table,
32
34 grn_tokenizer_query *query);
35
37 grn_token *current_token,
38 grn_token *next_token,
39 void *user_data);
40
42 void *user_data);
43
44
45/*
46 grn_token_filter_register() registers a plugin to the database which is
47 associated with `ctx'. `plugin_name_ptr' and `plugin_name_length' specify the
48 plugin name. Alphabetic letters ('A'-'Z' and 'a'-'z'), digits ('0'-'9') and
49 an underscore ('_') are capable characters.
50
51 `init', `filter' and `fin' specify the plugin functions.
52
53 `init' is called for initializing a token_filter for a document or
54 query.
55
56 `filter' is called for filtering tokens one by one.
57
58 `fin' is called for finalizing a token_filter.
59
60 grn_token_filter_register() returns GRN_SUCCESS on success, an error
61 code on failure.
62
63 Deprecated since 8.0.9. Use grn_token_filter_create() and
64 grn_token_filter_set_XXX_func() instead.
65 */
67 const char *plugin_name_ptr,
68 int plugin_name_length,
72
74grn_token_filter_create(grn_ctx *ctx, const char *name, int name_length);
75
78 grn_obj *token_filter,
82 grn_obj *token_filter,
86 grn_obj *token_filter,
88
89#ifdef __cplusplus
90} /* extern "C" */
91#endif /* __cplusplus */
grn_rc
Definition groonga.h:61
#define GRN_PLUGIN_EXPORT
Definition plugin.h:50
Definition groonga.h:351
Definition groonga.h:919
Definition tokenizer_query_deprecated.h:35
struct _grn_token grn_token
Definition token.h:127
grn_tokenize_mode
Definition token.h:37
void * grn_token_filter_init_func(grn_ctx *ctx, grn_obj *table, grn_tokenize_mode mode)
Definition token_filter.h:29
void * grn_token_filter_init_query_func(grn_ctx *ctx, grn_tokenizer_query *query)
Definition token_filter.h:33
GRN_PLUGIN_EXPORT grn_rc grn_token_filter_set_init_func(grn_ctx *ctx, grn_obj *token_filter, grn_token_filter_init_query_func *init)
GRN_PLUGIN_EXPORT grn_rc grn_token_filter_set_filter_func(grn_ctx *ctx, grn_obj *token_filter, grn_token_filter_filter_func *filter)
GRN_PLUGIN_EXPORT grn_obj * grn_token_filter_create(grn_ctx *ctx, const char *name, int name_length)
void grn_token_filter_filter_func(grn_ctx *ctx, grn_token *current_token, grn_token *next_token, void *user_data)
Definition token_filter.h:36
void grn_token_filter_fin_func(grn_ctx *ctx, void *user_data)
Definition token_filter.h:41
GRN_PLUGIN_EXPORT grn_rc grn_token_filter_register(grn_ctx *ctx, const char *plugin_name_ptr, int plugin_name_length, grn_token_filter_init_func *init, grn_token_filter_filter_func *filter, grn_token_filter_fin_func *fin)
GRN_PLUGIN_EXPORT grn_rc grn_token_filter_set_fin_func(grn_ctx *ctx, grn_obj *token_filter, grn_token_filter_fin_func *fin)