| 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 |
| 24 | extern "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 | |
| 34 | void grn_proc_init_from_env(void); |
| 35 | |
| 36 | GRN_VAR const char *grn_document_root; |
| 37 | void grn_db_init_builtin_commands(grn_ctx *ctx); |
| 38 | |
| 39 | void grn_proc_init_clearlock(grn_ctx *ctx); |
| 40 | void grn_proc_init_column_copy(grn_ctx *ctx); |
| 41 | void grn_proc_init_column_create(grn_ctx *ctx); |
| 42 | void grn_proc_init_column_list(grn_ctx *ctx); |
| 43 | void grn_proc_init_column_remove(grn_ctx *ctx); |
| 44 | void grn_proc_init_column_rename(grn_ctx *ctx); |
| 45 | void grn_proc_init_config_get(grn_ctx *ctx); |
| 46 | void grn_proc_init_config_set(grn_ctx *ctx); |
| 47 | void grn_proc_init_config_delete(grn_ctx *ctx); |
| 48 | void grn_proc_init_define_selector(grn_ctx *ctx); |
| 49 | void grn_proc_init_dump(grn_ctx *ctx); |
| 50 | void grn_proc_init_edit_distance(grn_ctx *ctx); |
| 51 | void grn_proc_init_fuzzy_search(grn_ctx *ctx); |
| 52 | void grn_proc_init_highlight(grn_ctx *ctx); |
| 53 | void grn_proc_init_highlight_full(grn_ctx *ctx); |
| 54 | void grn_proc_init_highlight_html(grn_ctx *ctx); |
| 55 | void grn_proc_init_in_records(grn_ctx *ctx); |
| 56 | void grn_proc_init_lock_acquire(grn_ctx *ctx); |
| 57 | void grn_proc_init_lock_clear(grn_ctx *ctx); |
| 58 | void grn_proc_init_lock_release(grn_ctx *ctx); |
| 59 | void grn_proc_init_object_exist(grn_ctx *ctx); |
| 60 | void grn_proc_init_object_inspect(grn_ctx *ctx); |
| 61 | void grn_proc_init_object_list(grn_ctx *ctx); |
| 62 | void grn_proc_init_object_remove(grn_ctx *ctx); |
| 63 | void grn_proc_init_query_expand(grn_ctx *ctx); |
| 64 | void grn_proc_init_query_log_flags_get(grn_ctx *ctx); |
| 65 | void grn_proc_init_query_log_flags_set(grn_ctx *ctx); |
| 66 | void grn_proc_init_query_log_flags_add(grn_ctx *ctx); |
| 67 | void grn_proc_init_query_log_flags_remove(grn_ctx *ctx); |
| 68 | void grn_proc_init_schema(grn_ctx *ctx); |
| 69 | void grn_proc_init_select(grn_ctx *ctx); |
| 70 | void grn_proc_init_snippet(grn_ctx *ctx); |
| 71 | void grn_proc_init_snippet_html(grn_ctx *ctx); |
| 72 | void grn_proc_init_table_copy(grn_ctx *ctx); |
| 73 | void grn_proc_init_table_create(grn_ctx *ctx); |
| 74 | void grn_proc_init_table_list(grn_ctx *ctx); |
| 75 | void grn_proc_init_table_remove(grn_ctx *ctx); |
| 76 | void grn_proc_init_table_rename(grn_ctx *ctx); |
| 77 | void grn_proc_init_table_tokenize(grn_ctx *ctx); |
| 78 | void grn_proc_init_tokenize(grn_ctx *ctx); |
| 79 | |
| 80 | grn_bool grn_proc_option_value_bool(grn_ctx *ctx, |
| 81 | grn_obj *option, |
| 82 | grn_bool default_value); |
| 83 | int32_t grn_proc_option_value_int32(grn_ctx *ctx, |
| 84 | grn_obj *option, |
| 85 | int32_t default_value); |
| 86 | const char *grn_proc_option_value_string(grn_ctx *ctx, |
| 87 | grn_obj *option, |
| 88 | size_t *size); |
| 89 | grn_content_type grn_proc_option_value_content_type(grn_ctx *ctx, |
| 90 | grn_obj *option, |
| 91 | grn_content_type default_value); |
| 92 | grn_operator grn_proc_option_value_mode(grn_ctx *ctx, |
| 93 | grn_obj *option, |
| 94 | grn_operator default_mode, |
| 95 | const char *context); |
| 96 | |
| 97 | |
| 98 | void grn_proc_output_object_name(grn_ctx *ctx, grn_obj *obj); |
| 99 | void grn_proc_output_object_id_name(grn_ctx *ctx, grn_id id); |
| 100 | |
| 101 | grn_bool grn_proc_table_set_token_filters(grn_ctx *ctx, |
| 102 | grn_obj *table, |
| 103 | grn_obj *token_filter_names); |
| 104 | |
| 105 | grn_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 | |
| 110 | grn_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); |
| 120 | grn_bool grn_proc_select_output_columns_close(grn_ctx *ctx, |
| 121 | grn_obj_format *format, |
| 122 | grn_obj *result_set); |
| 123 | grn_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 | |
| 132 | grn_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 | |
| 145 | grn_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 | |