1/* -*- c-basic-offset: 2 -*- */
2/*
3 Copyright(C) 2009-2017 Brazil
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 version 2.1 as published by the Free Software Foundation.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17*/
18
19#pragma once
20
21#include "grn.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#define GRN_SELECT_DEFAULT_LIMIT 10
28#define GRN_SELECT_DEFAULT_OUTPUT_COLUMNS "_id, _key, *"
29
30#define GRN_SELECT_INTERNAL_VAR_CONDITION "$condition"
31#define GRN_SELECT_INTERNAL_VAR_CONDITION_LEN \
32 (sizeof(GRN_SELECT_INTERNAL_VAR_CONDITION) - 1)
33
34void grn_proc_init_from_env(void);
35
36GRN_VAR const char *grn_document_root;
37void grn_db_init_builtin_commands(grn_ctx *ctx);
38
39void grn_proc_init_clearlock(grn_ctx *ctx);
40void grn_proc_init_column_copy(grn_ctx *ctx);
41void grn_proc_init_column_create(grn_ctx *ctx);
42void grn_proc_init_column_list(grn_ctx *ctx);
43void grn_proc_init_column_remove(grn_ctx *ctx);
44void grn_proc_init_column_rename(grn_ctx *ctx);
45void grn_proc_init_config_get(grn_ctx *ctx);
46void grn_proc_init_config_set(grn_ctx *ctx);
47void grn_proc_init_config_delete(grn_ctx *ctx);
48void grn_proc_init_define_selector(grn_ctx *ctx);
49void grn_proc_init_dump(grn_ctx *ctx);
50void grn_proc_init_edit_distance(grn_ctx *ctx);
51void grn_proc_init_fuzzy_search(grn_ctx *ctx);
52void grn_proc_init_highlight(grn_ctx *ctx);
53void grn_proc_init_highlight_full(grn_ctx *ctx);
54void grn_proc_init_highlight_html(grn_ctx *ctx);
55void grn_proc_init_in_records(grn_ctx *ctx);
56void grn_proc_init_lock_acquire(grn_ctx *ctx);
57void grn_proc_init_lock_clear(grn_ctx *ctx);
58void grn_proc_init_lock_release(grn_ctx *ctx);
59void grn_proc_init_object_exist(grn_ctx *ctx);
60void grn_proc_init_object_inspect(grn_ctx *ctx);
61void grn_proc_init_object_list(grn_ctx *ctx);
62void grn_proc_init_object_remove(grn_ctx *ctx);
63void grn_proc_init_query_expand(grn_ctx *ctx);
64void grn_proc_init_query_log_flags_get(grn_ctx *ctx);
65void grn_proc_init_query_log_flags_set(grn_ctx *ctx);
66void grn_proc_init_query_log_flags_add(grn_ctx *ctx);
67void grn_proc_init_query_log_flags_remove(grn_ctx *ctx);
68void grn_proc_init_schema(grn_ctx *ctx);
69void grn_proc_init_select(grn_ctx *ctx);
70void grn_proc_init_snippet(grn_ctx *ctx);
71void grn_proc_init_snippet_html(grn_ctx *ctx);
72void grn_proc_init_table_copy(grn_ctx *ctx);
73void grn_proc_init_table_create(grn_ctx *ctx);
74void grn_proc_init_table_list(grn_ctx *ctx);
75void grn_proc_init_table_remove(grn_ctx *ctx);
76void grn_proc_init_table_rename(grn_ctx *ctx);
77void grn_proc_init_table_tokenize(grn_ctx *ctx);
78void grn_proc_init_tokenize(grn_ctx *ctx);
79
80grn_bool grn_proc_option_value_bool(grn_ctx *ctx,
81 grn_obj *option,
82 grn_bool default_value);
83int32_t grn_proc_option_value_int32(grn_ctx *ctx,
84 grn_obj *option,
85 int32_t default_value);
86const char *grn_proc_option_value_string(grn_ctx *ctx,
87 grn_obj *option,
88 size_t *size);
89grn_content_type grn_proc_option_value_content_type(grn_ctx *ctx,
90 grn_obj *option,
91 grn_content_type default_value);
92grn_operator grn_proc_option_value_mode(grn_ctx *ctx,
93 grn_obj *option,
94 grn_operator default_mode,
95 const char *context);
96
97
98void grn_proc_output_object_name(grn_ctx *ctx, grn_obj *obj);
99void grn_proc_output_object_id_name(grn_ctx *ctx, grn_id id);
100
101grn_bool grn_proc_table_set_token_filters(grn_ctx *ctx,
102 grn_obj *table,
103 grn_obj *token_filter_names);
104
105grn_column_flags grn_proc_column_parse_flags(grn_ctx *ctx,
106 const char *error_message_tag,
107 const char *text,
108 const char *end);
109
110grn_bool grn_proc_select_output_columns_open(grn_ctx *ctx,
111 grn_obj_format *format,
112 grn_obj *result_set,
113 int n_hits,
114 int offset,
115 int limit,
116 const char *columns,
117 int columns_len,
118 grn_obj *condition,
119 uint32_t n_additional_elements);
120grn_bool grn_proc_select_output_columns_close(grn_ctx *ctx,
121 grn_obj_format *format,
122 grn_obj *result_set);
123grn_bool grn_proc_select_output_columns(grn_ctx *ctx,
124 grn_obj *res,
125 int n_hits,
126 int offset,
127 int limit,
128 const char *columns,
129 int columns_len,
130 grn_obj *condition);
131
132grn_rc grn_proc_syntax_expand_query(grn_ctx *ctx,
133 const char *query,
134 unsigned int query_len,
135 grn_expr_flags flags,
136 const char *query_expander_name,
137 unsigned int query_expander_name_len,
138 const char *term_column_name,
139 unsigned int term_column_name_len,
140 const char *expanded_term_column_name,
141 unsigned int expanded_term_column_name_len,
142 grn_obj *expanded_query,
143 const char *error_message_tag);
144
145grn_expr_flags grn_proc_expr_query_flags_parse(grn_ctx *ctx,
146 const char *query_flags,
147 size_t query_flags_size,
148 const char *error_message_tag);
149
150#ifdef __cplusplus
151}
152#endif
153