| 1 | /* |
| 2 | Copyright (C) 2009-2018 Brazil |
| 3 | Copyright (C) 2018-2026 Sutou Kouhei <[email protected]> |
| 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 | #include "../grn_proc.h"cxx . . $ `<file>/lib/grn_proc.h`/ |
| 21 | #include "../grn_ctx.h"cxx . . $ `<file>/lib/grn_ctx.h`/ |
| 22 | #include "../grn_token_cursor.h"cxx . . $ `<file>/lib/grn_token_cursor.h`/ |
| 23 | |
| 24 | #include <groonga/plugin.h>cxx . . $ `<file>/include/groonga/plugin.h`/ |
| 25 | |
| 26 | typedef structcxx . . $ $anonymous_type_cda73908e23331e2_0# { |
| 27 | grn_idcxx . . $ grn_id# idcxx . . $ $anonymous_type_cda73908e23331e2_0#id.; |
| 28 | int32_tcxx . . $ int32_t# positioncxx . . $ $anonymous_type_cda73908e23331e2_0#position.; |
| 29 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! force_prefix_searchcxx . . $ $anonymous_type_cda73908e23331e2_0#force_prefix_search.; |
| 30 | uint64_tcxx . . $ uint64_t# source_offsetcxx . . $ $anonymous_type_cda73908e23331e2_0#source_offset.; |
| 31 | uint32_tcxx . . $ uint32_t# source_lengthcxx . . $ $anonymous_type_cda73908e23331e2_0#source_length.; |
| 32 | uint32_tcxx . . $ uint32_t# source_first_character_lengthcxx . . $ $anonymous_type_cda73908e23331e2_0#source_first_character_length.; |
| 33 | grn_objcxx . . $ grn_obj# metadatacxx . . $ $anonymous_type_cda73908e23331e2_0#metadata.; |
| 34 | } tokenize_tokencxx . . $ tokenize_token#; |
| 35 | |
| 36 | static void |
| 37 | init_tokenscxx . . $ init_tokens(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *tokens) |
| 38 | { |
| 39 | GRN_VALUE_FIX_SIZE_INITcxx . . $ `include/groonga/groonga.h:2738:9`!(tokens, GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!); |
| 40 | } |
| 41 | |
| 42 | static void |
| 43 | fin_tokenscxx . . $ fin_tokens(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *tokens) |
| 44 | { |
| 45 | size_t i; |
| 46 | size_t n_tokens; |
| 47 | |
| 48 | n_tokens = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(tokens) / sizeof(tokenize_tokencxx . . $ tokenize_token#); |
| 49 | for (i = 0; i < n_tokens; i++) { |
| 50 | tokenize_tokencxx . . $ tokenize_token# *token; |
| 51 | token = ((tokenize_tokencxx . . $ tokenize_token# *)(GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(tokens))) + i; |
| 52 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(token->metadata)); |
| 53 | } |
| 54 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, tokens); |
| 55 | } |
| 56 | |
| 57 | static void |
| 58 | output_tokens_simplecxx . . $ output_tokens_simple(99eba0d3a8372d65).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *tokens, grn_objcxx . . $ grn_obj# *lexicon) |
| 59 | { |
| 60 | size_t i; |
| 61 | size_t n_tokens = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(tokens) / sizeof(tokenize_tokencxx . . $ tokenize_token#); |
| 62 | |
| 63 | grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "TOKENS", (int)n_tokens); |
| 64 | grn_objcxx . . $ grn_obj# key; |
| 65 | GRN_OBJ_INITcxx . . $ `include/groonga/groonga.h:947:9`!(&key, GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!, lexicon->header.domain); |
| 66 | tokenize_tokencxx . . $ tokenize_token# *tokenize_tokens = (tokenize_tokencxx . . $ tokenize_token# *)GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(tokens); |
| 67 | for (i = 0; i < n_tokens; i++) { |
| 68 | tokenize_tokencxx . . $ tokenize_token# *token = tokenize_tokens + i; |
| 69 | |
| 70 | char value[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!]; |
| 71 | int value_size = |
| 72 | grn_table_get_keycxx . . $ grn_table_get_key(2c24f49dad267d35).(ctx, lexicon, token->idcxx . . $ $anonymous_type_cda73908e23331e2_0#id., value, sizeof(value)); |
| 73 | |
| 74 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, &key, value, value_size); |
| 75 | grn_ctx_output_objcxx . . $ grn_ctx_output_obj(eded88d24d5f23db).(ctx, &key, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 76 | } |
| 77 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &key); |
| 78 | grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx); |
| 79 | } |
| 80 | |
| 81 | static void |
| 82 | output_tokenscxx . . $ output_tokens(4ad76b35c8eff5b1).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 83 | grn_objcxx . . $ grn_obj# *tokens, |
| 84 | grn_objcxx . . $ grn_obj# *lexicon, |
| 85 | grn_objcxx . . $ grn_obj# *index_column) |
| 86 | { |
| 87 | size_t i, n_tokens, n_elements; |
| 88 | grn_objcxx . . $ grn_obj# estimated_size; |
| 89 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! have_source_location = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 90 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! have_metadata = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 91 | |
| 92 | n_tokens = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(tokens) / sizeof(tokenize_tokencxx . . $ tokenize_token#); |
| 93 | n_elements = 4; |
| 94 | if (index_column) { |
| 95 | n_elements++; |
| 96 | GRN_UINT32_INITcxx . . $ `include/groonga/groonga.h:2854:9`!(&estimated_size, 0); |
| 97 | } |
| 98 | for (i = 0; i < n_tokens; i++) { |
| 99 | tokenize_tokencxx . . $ tokenize_token# *token; |
| 100 | token = ((tokenize_tokencxx . . $ tokenize_token# *)(GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(tokens))) + i; |
| 101 | if (token->source_offsetcxx . . $ $anonymous_type_cda73908e23331e2_0#source_offset. > 0 || token->source_lengthcxx . . $ $anonymous_type_cda73908e23331e2_0#source_length. > 0) { |
| 102 | have_source_location = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 103 | } |
| 104 | if (grn_vector_sizecxx . . $ grn_vector_size(8dd58acc9865e889).(ctx, &(token->metadatacxx . . $ $anonymous_type_cda73908e23331e2_0#metadata.)) > 0) { |
| 105 | have_metadata = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 106 | } |
| 107 | } |
| 108 | if (have_source_location) { |
| 109 | n_elements += 3; |
| 110 | } |
| 111 | if (have_metadata) { |
| 112 | n_elements += 1; |
| 113 | } |
| 114 | |
| 115 | grn_ctx_output_array_opencxx . . $ grn_ctx_output_array_open(f0f392d632556531).(ctx, "TOKENS", (int)n_tokens); |
| 116 | for (i = 0; i < n_tokens; i++) { |
| 117 | tokenize_tokencxx . . $ tokenize_token# *token; |
| 118 | |
| 119 | token = ((tokenize_tokencxx . . $ tokenize_token# *)(GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(tokens))) + i; |
| 120 | |
| 121 | grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "TOKEN", (int)n_elements); |
| 122 | |
| 123 | grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "value"); |
| 124 | { |
| 125 | char value[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!]; |
| 126 | int value_size; |
| 127 | value_size = grn_table_get_keycxx . . $ grn_table_get_key(2c24f49dad267d35).(ctx, |
| 128 | lexicon, |
| 129 | token->idcxx . . $ $anonymous_type_cda73908e23331e2_0#id., |
| 130 | value, |
| 131 | GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!); |
| 132 | grn_objcxx . . $ grn_obj# key; |
| 133 | GRN_OBJ_INITcxx . . $ `include/groonga/groonga.h:947:9`!(&key, |
| 134 | GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!, |
| 135 | GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!, |
| 136 | lexicon->header.domain); |
| 137 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, &key, value, value_size); |
| 138 | grn_ctx_output_objcxx . . $ grn_ctx_output_obj(eded88d24d5f23db).(ctx, &key, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 139 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &key); |
| 140 | } |
| 141 | |
| 142 | grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "position"); |
| 143 | grn_ctx_output_int32cxx . . $ grn_ctx_output_int32(55555b1fc84b4259).(ctx, token->positioncxx . . $ $anonymous_type_cda73908e23331e2_0#position.); |
| 144 | |
| 145 | /* For backward compatibility. */ |
| 146 | grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "force_prefix"); |
| 147 | grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, token->force_prefix_searchcxx . . $ $anonymous_type_cda73908e23331e2_0#force_prefix_search.); |
| 148 | |
| 149 | grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "force_prefix_search"); |
| 150 | grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, token->force_prefix_searchcxx . . $ $anonymous_type_cda73908e23331e2_0#force_prefix_search.); |
| 151 | |
| 152 | if (index_column) { |
| 153 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&estimated_size); |
| 154 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, index_column, token->idcxx . . $ $anonymous_type_cda73908e23331e2_0#id., &estimated_size); |
| 155 | grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "estimated_size"); |
| 156 | grn_ctx_output_int64cxx . . $ grn_ctx_output_int64(e824ee96bb92de8).(ctx, GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(&estimated_size)); |
| 157 | } |
| 158 | |
| 159 | if (have_source_location) { |
| 160 | grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "source_offset"); |
| 161 | grn_ctx_output_uint64cxx . . $ grn_ctx_output_uint64(150f498c5f9d24bd).(ctx, token->source_offsetcxx . . $ $anonymous_type_cda73908e23331e2_0#source_offset.); |
| 162 | |
| 163 | grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "source_length"); |
| 164 | grn_ctx_output_uint32cxx . . $ grn_ctx_output_uint32(969b9cdb234920c4).(ctx, token->source_lengthcxx . . $ $anonymous_type_cda73908e23331e2_0#source_length.); |
| 165 | |
| 166 | grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "source_first_character_length"); |
| 167 | grn_ctx_output_uint32cxx . . $ grn_ctx_output_uint32(969b9cdb234920c4).(ctx, token->source_first_character_lengthcxx . . $ $anonymous_type_cda73908e23331e2_0#source_first_character_length.); |
| 168 | } |
| 169 | |
| 170 | if (have_metadata) { |
| 171 | size_t i; |
| 172 | size_t n_metadata; |
| 173 | grn_objcxx . . $ grn_obj# value; |
| 174 | |
| 175 | n_metadata = grn_vector_sizecxx . . $ grn_vector_size(8dd58acc9865e889).(ctx, &(token->metadatacxx . . $ $anonymous_type_cda73908e23331e2_0#metadata.)) / 2; |
| 176 | GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(&value); |
| 177 | grn_ctx_output_cstrcxx . . $ grn_ctx_output_cstr(777524e3d10dd7b4).(ctx, "metadata"); |
| 178 | grn_ctx_output_map_opencxx . . $ grn_ctx_output_map_open(f0f392d632556531).(ctx, "METADATA", (int)n_metadata); |
| 179 | for (i = 0; i < n_metadata; i++) { |
| 180 | const char *raw_name; |
| 181 | unsigned int raw_name_length; |
| 182 | const char *raw_value; |
| 183 | unsigned int raw_value_length; |
| 184 | grn_idcxx . . $ grn_id# value_domain; |
| 185 | |
| 186 | raw_name_length = grn_vector_get_elementcxx . . $ grn_vector_get_element(744613554bd9830c).(ctx, |
| 187 | &(token->metadatacxx . . $ $anonymous_type_cda73908e23331e2_0#metadata.), |
| 188 | (uint32_tcxx . . $ uint32_t#)(i * 2), |
| 189 | &raw_name, |
| 190 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 191 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 192 | grn_ctx_output_strcxx . . $ grn_ctx_output_str(bd29ebb5071afc4b).(ctx, raw_name, raw_name_length); |
| 193 | |
| 194 | raw_value_length = grn_vector_get_elementcxx . . $ grn_vector_get_element(744613554bd9830c).(ctx, |
| 195 | &(token->metadatacxx . . $ $anonymous_type_cda73908e23331e2_0#metadata.), |
| 196 | (uint32_tcxx . . $ uint32_t#)(i * 2 + 1), |
| 197 | &raw_value, |
| 198 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 199 | &value_domain); |
| 200 | grn_obj_reinitcxx . . $ grn_obj_reinit(fc9ea836325dd1d2).(ctx, &value, value_domain, 0); |
| 201 | grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, &value, raw_value, raw_value_length); |
| 202 | grn_ctx_output_objcxx . . $ grn_ctx_output_obj(eded88d24d5f23db).(ctx, &value, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 203 | } |
| 204 | grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx); |
| 205 | |
| 206 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &value); |
| 207 | } |
| 208 | |
| 209 | grn_ctx_output_map_closecxx . . $ grn_ctx_output_map_close(b578cd6e53d5fe91).(ctx); |
| 210 | } |
| 211 | |
| 212 | if (index_column) { |
| 213 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &estimated_size); |
| 214 | } |
| 215 | |
| 216 | grn_ctx_output_array_closecxx . . $ grn_ctx_output_array_close(b578cd6e53d5fe91).(ctx); |
| 217 | } |
| 218 | |
| 219 | static void |
| 220 | tokenizecxx . . $ tokenize(2bf2d91b5cfb043e).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 221 | grn_objcxx . . $ grn_obj# *lexicon, |
| 222 | grn_raw_stringcxx . . $ grn_raw_string# *string_raw, |
| 223 | grn_tokenize_modecxx . . $ grn_tokenize_mode# mode, |
| 224 | unsigned int flags, |
| 225 | grn_objcxx . . $ grn_obj# *tokens) |
| 226 | { |
| 227 | grn_token_cursorcxx . . $ grn_token_cursor# *token_cursor; |
| 228 | |
| 229 | token_cursor = grn_token_cursor_opencxx . . $ grn_token_cursor_open(b521006a1987c493).(ctx, |
| 230 | lexicon, |
| 231 | string_raw->valuecxx . . $ $anonymous_type_7f733dd816802915_0#value., |
| 232 | string_raw->lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length., |
| 233 | mode, |
| 234 | flags); |
| 235 | if (!token_cursor) { |
| 236 | return; |
| 237 | } |
| 238 | |
| 239 | grn_token_cursor_set_query_domaincxx . . $ grn_token_cursor_set_query_domain(fe988a01052ed552).(ctx, token_cursor, GRN_DB_TEXTcxx . . $ GRN_DB_TEXT.); |
| 240 | while (token_cursor->statuscxx . . $ _grn_token_cursor#status. == GRN_TOKEN_CURSOR_DOINGcxx . . $ GRN_TOKEN_CURSOR_DOING.) { |
| 241 | grn_idcxx . . $ grn_id# token_id = grn_token_cursor_nextcxx . . $ grn_token_cursor_next(60c29d5cf5463368).(ctx, token_cursor); |
| 242 | grn_tokencxx . . $ grn_token# *token; |
| 243 | tokenize_tokencxx . . $ tokenize_token# *current_token; |
| 244 | |
| 245 | if (token_id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) { |
| 246 | continue; |
| 247 | } |
| 248 | token = grn_token_cursor_get_tokencxx . . $ grn_token_cursor_get_token(42eb6886c4ba0dd1).(ctx, token_cursor); |
| 249 | grn_bulk_spacecxx . . $ grn_bulk_space(f9a66385f261f61d).(ctx, tokens, sizeof(tokenize_tokencxx . . $ tokenize_token#)); |
| 250 | current_token = ((tokenize_tokencxx . . $ tokenize_token# *)(GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(tokens))) - 1; |
| 251 | current_token->idcxx . . $ $anonymous_type_cda73908e23331e2_0#id. = token_id; |
| 252 | current_token->positioncxx . . $ $anonymous_type_cda73908e23331e2_0#position. = (int32_tcxx . . $ int32_t#)grn_token_get_positioncxx . . $ grn_token_get_position(e181e4c8cedfccbf).(ctx, token); |
| 253 | current_token->force_prefix_searchcxx . . $ $anonymous_type_cda73908e23331e2_0#force_prefix_search. = |
| 254 | grn_token_get_force_prefix_searchcxx . . $ grn_token_get_force_prefix_search(5548dc6ca4c05dee).(ctx, token); |
| 255 | current_token->source_offsetcxx . . $ $anonymous_type_cda73908e23331e2_0#source_offset. = grn_token_get_source_offsetcxx . . $ grn_token_get_source_offset(6b88337da967ca79).(ctx, token); |
| 256 | current_token->source_lengthcxx . . $ $anonymous_type_cda73908e23331e2_0#source_length. = grn_token_get_source_lengthcxx . . $ grn_token_get_source_length(e181e4c8cedfccbf).(ctx, token); |
| 257 | current_token->source_first_character_lengthcxx . . $ $anonymous_type_cda73908e23331e2_0#source_first_character_length. = |
| 258 | grn_token_get_source_first_character_lengthcxx . . $ grn_token_get_source_first_character_length(e181e4c8cedfccbf).(ctx, token); |
| 259 | |
| 260 | { |
| 261 | grn_objcxx . . $ grn_obj# *metadata; |
| 262 | size_t n_metadata; |
| 263 | size_t i; |
| 264 | grn_objcxx . . $ grn_obj# name; |
| 265 | grn_objcxx . . $ grn_obj# value; |
| 266 | |
| 267 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&(current_token->metadata), GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!); |
| 268 | metadata = grn_token_get_metadatacxx . . $ grn_token_get_metadata(fa6b3ffdb9b18cb).(ctx, token); |
| 269 | n_metadata = grn_token_metadata_get_sizecxx . . $ grn_token_metadata_get_size(2ef1bf33a3428727).(ctx, metadata); |
| 270 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&name, 0); |
| 271 | GRN_VOID_INITcxx . . $ `include/groonga/groonga.h:2749:9`!(&value); |
| 272 | for (i = 0; i < n_metadata; i++) { |
| 273 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&name); |
| 274 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&value); |
| 275 | grn_token_metadata_atcxx . . $ grn_token_metadata_at(a938478d1137080a).(ctx, metadata, i, &name, &value); |
| 276 | if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&name) == 0) { |
| 277 | continue; |
| 278 | } |
| 279 | grn_vector_add_elementcxx . . $ grn_vector_add_element(d170aee3d3986928).(ctx, |
| 280 | &(current_token->metadatacxx . . $ $anonymous_type_cda73908e23331e2_0#metadata.), |
| 281 | GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(&name), |
| 282 | (uint32_tcxx . . $ uint32_t#)GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&name), |
| 283 | 0, |
| 284 | name.headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.); |
| 285 | grn_vector_add_elementcxx . . $ grn_vector_add_element(d170aee3d3986928).(ctx, |
| 286 | &(current_token->metadatacxx . . $ $anonymous_type_cda73908e23331e2_0#metadata.), |
| 287 | GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(&value), |
| 288 | (uint32_tcxx . . $ uint32_t#)GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&value), |
| 289 | 0, |
| 290 | value.headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.); |
| 291 | } |
| 292 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &name); |
| 293 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &value); |
| 294 | } |
| 295 | } |
| 296 | grn_token_cursor_closecxx . . $ grn_token_cursor_close(fbd52f00bdc6c9ff).(ctx, token_cursor); |
| 297 | } |
| 298 | |
| 299 | static grn_objcxx . . $ grn_obj# * |
| 300 | command_table_tokenizecxx . . $ command_table_tokenize(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 301 | int nargs, |
| 302 | grn_objcxx . . $ grn_obj# **args, |
| 303 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 304 | { |
| 305 | grn_raw_stringcxx . . $ grn_raw_string# table_raw; |
| 306 | grn_raw_stringcxx . . $ grn_raw_string# string_raw; |
| 307 | grn_objcxx . . $ grn_obj# *flags_raw; |
| 308 | grn_objcxx . . $ grn_obj# *mode_raw; |
| 309 | grn_raw_stringcxx . . $ grn_raw_string# index_column_raw; |
| 310 | grn_raw_stringcxx . . $ grn_raw_string# output_style_raw; |
| 311 | |
| 312 | #define GET_VALUEcxx . . $ `lib/proc/proc_tokenize.c:312:9`!(name) \ |
| 313 | name##_raw.value = grn_plugin_proc_get_var_string(ctx, \ |
| 314 | user_data, \ |
| 315 | #name, \ |
| 316 | strlen(#name), \ |
| 317 | &(name##_raw.length)) |
| 318 | |
| 319 | GET_VALUEcxx . . $ `lib/proc/proc_tokenize.c:312:9`!(table); |
| 320 | GET_VALUEcxx . . $ `lib/proc/proc_tokenize.c:312:9`!(string); |
| 321 | flags_raw = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "flags", strlencxx . . $ strlen(751346f8406fd082).("flags")); |
| 322 | mode_raw = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "mode", strlencxx . . $ strlen(751346f8406fd082).("mode")); |
| 323 | GET_VALUEcxx . . $ `lib/proc/proc_tokenize.c:312:9`!(index_column); |
| 324 | GET_VALUEcxx . . $ `lib/proc/proc_tokenize.c:312:9`!(output_style); |
| 325 | |
| 326 | #undef GET_VALUEcxx . . $ `lib/proc/proc_tokenize.c:312:9`! |
| 327 | |
| 328 | if (table_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. == 0) { |
| 329 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, |
| 330 | GRN_INVALID_ARGUMENT, |
| 331 | "[table_tokenize] table name is missing"); |
| 332 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 333 | } |
| 334 | |
| 335 | if (string_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. == 0) { |
| 336 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, |
| 337 | GRN_INVALID_ARGUMENT, |
| 338 | "[table_tokenize] string is missing"); |
| 339 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 340 | } |
| 341 | |
| 342 | { |
| 343 | uint32_tcxx . . $ uint32_t# flags; |
| 344 | grn_objcxx . . $ grn_obj# *lexicon; |
| 345 | grn_objcxx . . $ grn_obj# *index_column = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 346 | |
| 347 | flags = grn_proc_get_value_token_cursor_flagscxx . . $ grn_proc_get_value_token_cursor_flags(edee37734fa14a15).(ctx, |
| 348 | flags_raw, |
| 349 | 0, |
| 350 | "[table_tokenize][flags]"); |
| 351 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 352 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 353 | } |
| 354 | |
| 355 | lexicon = grn_ctx_getcxx . . $ grn_ctx_get(70fde0087014f9ea).(ctx, table_raw.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value., (int)(table_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.)); |
| 356 | if (!lexicon) { |
| 357 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, |
| 358 | GRN_INVALID_ARGUMENT, |
| 359 | "[table_tokenize] nonexistent lexicon: <%.*s>", |
| 360 | (int)table_raw.length, |
| 361 | table_raw.value); |
| 362 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 363 | } |
| 364 | |
| 365 | if (index_column_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. > 0) { |
| 366 | index_column = grn_obj_columncxx . . $ grn_obj_column(c00e49795c44129a).(ctx, |
| 367 | lexicon, |
| 368 | index_column_raw.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value., |
| 369 | (uint32_tcxx . . $ uint32_t#)(index_column_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.)); |
| 370 | if (!index_column) { |
| 371 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, |
| 372 | GRN_INVALID_ARGUMENT, |
| 373 | "[table_tokenize] nonexistent index column: <%.*s>", |
| 374 | (int)index_column_raw.length, |
| 375 | index_column_raw.value); |
| 376 | goto exit; |
| 377 | } |
| 378 | if (index_column->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. != GRN_COLUMN_INDEXcxx . . $ `include/groonga/groonga.h:902:9`!) { |
| 379 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, |
| 380 | GRN_INVALID_ARGUMENT, |
| 381 | "[table_tokenize] " |
| 382 | "index column must be COLUMN_INDEX: <%.*s>", |
| 383 | (int)index_column_raw.length, |
| 384 | index_column_raw.value); |
| 385 | goto exit; |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | { |
| 390 | grn_objcxx . . $ grn_obj# tokens; |
| 391 | init_tokenscxx . . $ init_tokens(cda3a5f3c2e53c6b).(ctx, &tokens); |
| 392 | grn_tokenize_modecxx . . $ grn_tokenize_mode# mode = |
| 393 | grn_proc_get_value_tokenize_modecxx . . $ grn_proc_get_value_tokenize_mode(c059d05b18bb04e9).(ctx, |
| 394 | mode_raw, |
| 395 | GRN_TOKENIZE_GETcxx . . $ GRN_TOKENIZE_GET., |
| 396 | "[table_tokenize][mode]"); |
| 397 | if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 398 | tokenizecxx . . $ tokenize(2bf2d91b5cfb043e).(ctx, lexicon, &string_raw, mode, flags, &tokens); |
| 399 | if (GRN_RAW_STRING_EQUAL_CSTRINGcxx . . $ `include/groonga/raw_string.h:57:9`!(output_style_raw, "simple")) { |
| 400 | output_tokens_simplecxx . . $ output_tokens_simple(99eba0d3a8372d65).(ctx, &tokens, lexicon); |
| 401 | } else { |
| 402 | output_tokenscxx . . $ output_tokens(4ad76b35c8eff5b1).(ctx, &tokens, lexicon, index_column); |
| 403 | } |
| 404 | } |
| 405 | fin_tokenscxx . . $ fin_tokens(cda3a5f3c2e53c6b).(ctx, &tokens); |
| 406 | } |
| 407 | #undef MODE_NAME_EQUAL |
| 408 | |
| 409 | exit: |
| 410 | grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, lexicon); |
| 411 | if (index_column) { |
| 412 | grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, index_column); |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 417 | } |
| 418 | |
| 419 | void |
| 420 | grn_proc_init_table_tokenizecxx . . $ grn_proc_init_table_tokenize(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 421 | { |
| 422 | #define N_ARGScxx . . $ `lib/proc/proc_tokenize.c:422:9`! 6 |
| 423 | grn_expr_varcxx . . $ grn_expr_var# vars[N_ARGScxx . . $ `lib/proc/proc_tokenize.c:422:9`!]; |
| 424 | |
| 425 | grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[0]), "table", -1); |
| 426 | grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[1]), "string", -1); |
| 427 | grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[2]), "flags", -1); |
| 428 | grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[3]), "mode", -1); |
| 429 | grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[4]), "index_column", -1); |
| 430 | grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[5]), "output_style", -1); |
| 431 | grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx, |
| 432 | "table_tokenize", |
| 433 | -1, |
| 434 | command_table_tokenizecxx . . $ command_table_tokenize(fd082858389c8bb0)., |
| 435 | N_ARGScxx . . $ `lib/proc/proc_tokenize.c:422:9`!, |
| 436 | vars); |
| 437 | #undef N_ARGScxx . . $ `lib/proc/proc_tokenize.c:422:9`! |
| 438 | } |
| 439 | |
| 440 | static grn_objcxx . . $ grn_obj# * |
| 441 | command_tokenizecxx . . $ command_tokenize(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 442 | int nargs, |
| 443 | grn_objcxx . . $ grn_obj# **args, |
| 444 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 445 | { |
| 446 | const char *context_tag = "[tokenize]"; |
| 447 | grn_raw_stringcxx . . $ grn_raw_string# tokenizer_raw; |
| 448 | grn_raw_stringcxx . . $ grn_raw_string# string_raw; |
| 449 | grn_raw_stringcxx . . $ grn_raw_string# normalizer_raw; |
| 450 | grn_objcxx . . $ grn_obj# *flags_raw; |
| 451 | grn_objcxx . . $ grn_obj# *mode_raw; |
| 452 | grn_raw_stringcxx . . $ grn_raw_string# token_filters_raw; |
| 453 | grn_raw_stringcxx . . $ grn_raw_string# output_style_raw; |
| 454 | |
| 455 | #define GET_VALUEcxx . . $ `lib/proc/proc_tokenize.c:455:9`!(name) \ |
| 456 | name##_raw.value = grn_plugin_proc_get_var_string(ctx, \ |
| 457 | user_data, \ |
| 458 | #name, \ |
| 459 | strlen(#name), \ |
| 460 | &(name##_raw.length)) |
| 461 | |
| 462 | GET_VALUEcxx . . $ `lib/proc/proc_tokenize.c:455:9`!(tokenizer); |
| 463 | GET_VALUEcxx . . $ `lib/proc/proc_tokenize.c:455:9`!(string); |
| 464 | GET_VALUEcxx . . $ `lib/proc/proc_tokenize.c:455:9`!(normalizer); |
| 465 | flags_raw = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "flags", strlencxx . . $ strlen(751346f8406fd082).("flags")); |
| 466 | mode_raw = grn_plugin_proc_get_varcxx . . $ grn_plugin_proc_get_var(3074f8d72b0d40ab).(ctx, user_data, "mode", strlencxx . . $ strlen(751346f8406fd082).("mode")); |
| 467 | GET_VALUEcxx . . $ `lib/proc/proc_tokenize.c:455:9`!(token_filters); |
| 468 | GET_VALUEcxx . . $ `lib/proc/proc_tokenize.c:455:9`!(output_style); |
| 469 | |
| 470 | #undef GET_VALUEcxx . . $ `lib/proc/proc_tokenize.c:455:9`! |
| 471 | |
| 472 | if (tokenizer_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. == 0) { |
| 473 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, |
| 474 | GRN_INVALID_ARGUMENT, |
| 475 | "%s tokenizer name is missing", |
| 476 | context_tag); |
| 477 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 478 | } |
| 479 | |
| 480 | if (string_raw.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. == 0) { |
| 481 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, |
| 482 | GRN_INVALID_ARGUMENT, |
| 483 | "%s string is missing", |
| 484 | context_tag); |
| 485 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 486 | } |
| 487 | |
| 488 | { |
| 489 | uint32_tcxx . . $ uint32_t# flags; |
| 490 | grn_objcxx . . $ grn_obj# *lexicon; |
| 491 | |
| 492 | flags = grn_proc_get_value_token_cursor_flagscxx . . $ grn_proc_get_value_token_cursor_flags(edee37734fa14a15).(ctx, |
| 493 | flags_raw, |
| 494 | 0, |
| 495 | "[tokenize][flags]"); |
| 496 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 497 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 498 | } |
| 499 | |
| 500 | lexicon = grn_proc_lexicon_opencxx . . $ grn_proc_lexicon_open(44e18c98336dc3bd).(ctx, |
| 501 | &tokenizer_raw, |
| 502 | &normalizer_raw, |
| 503 | &token_filters_raw, |
| 504 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 505 | context_tag); |
| 506 | if (!lexicon) { |
| 507 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 508 | } |
| 509 | |
| 510 | { |
| 511 | grn_objcxx . . $ grn_obj# tokens; |
| 512 | init_tokenscxx . . $ init_tokens(cda3a5f3c2e53c6b).(ctx, &tokens); |
| 513 | grn_tokenize_modecxx . . $ grn_tokenize_mode# mode = |
| 514 | grn_proc_get_value_tokenize_modecxx . . $ grn_proc_get_value_tokenize_mode(c059d05b18bb04e9).(ctx, |
| 515 | mode_raw, |
| 516 | GRN_TOKENIZE_ADDcxx . . $ GRN_TOKENIZE_ADD., |
| 517 | "[tokenize][mode]"); |
| 518 | if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 519 | tokenizecxx . . $ tokenize(2bf2d91b5cfb043e).(ctx, lexicon, &string_raw, GRN_TOKENIZE_ADDcxx . . $ GRN_TOKENIZE_ADD., flags, &tokens); |
| 520 | if (mode != GRN_TOKENIZE_ADDcxx . . $ GRN_TOKENIZE_ADD.) { |
| 521 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&tokens); |
| 522 | tokenizecxx . . $ tokenize(2bf2d91b5cfb043e).(ctx, lexicon, &string_raw, mode, flags, &tokens); |
| 523 | } |
| 524 | if (GRN_RAW_STRING_EQUAL_CSTRINGcxx . . $ `include/groonga/raw_string.h:57:9`!(output_style_raw, "simple")) { |
| 525 | output_tokens_simplecxx . . $ output_tokens_simple(99eba0d3a8372d65).(ctx, &tokens, lexicon); |
| 526 | } else { |
| 527 | output_tokenscxx . . $ output_tokens(4ad76b35c8eff5b1).(ctx, &tokens, lexicon, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 528 | } |
| 529 | } |
| 530 | fin_tokenscxx . . $ fin_tokens(cda3a5f3c2e53c6b).(ctx, &tokens); |
| 531 | } |
| 532 | #undef MODE_NAME_EQUAL |
| 533 | |
| 534 | grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, lexicon); |
| 535 | } |
| 536 | |
| 537 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 538 | } |
| 539 | |
| 540 | void |
| 541 | grn_proc_init_tokenizecxx . . $ grn_proc_init_tokenize(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 542 | { |
| 543 | #define N_ARGScxx . . $ `lib/proc/proc_tokenize.c:543:9`! 7 |
| 544 | grn_expr_varcxx . . $ grn_expr_var# vars[N_ARGScxx . . $ `lib/proc/proc_tokenize.c:543:9`!]; |
| 545 | |
| 546 | grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[0]), "tokenizer", -1); |
| 547 | grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[1]), "string", -1); |
| 548 | grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[2]), "normalizer", -1); |
| 549 | grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[3]), "flags", -1); |
| 550 | grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[4]), "mode", -1); |
| 551 | grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[5]), "token_filters", -1); |
| 552 | grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[6]), "output_style", -1); |
| 553 | grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx, |
| 554 | "tokenize", |
| 555 | -1, |
| 556 | command_tokenizecxx . . $ command_tokenize(fd082858389c8bb0)., |
| 557 | N_ARGScxx . . $ `lib/proc/proc_tokenize.c:543:9`!, |
| 558 | vars); |
| 559 | #undef N_ARGScxx . . $ `lib/proc/proc_tokenize.c:543:9`! |
| 560 | } |