| 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 | |
| 23 | #include <groonga/plugin.h>cxx . . $ `<file>/include/groonga/plugin.h`/ |
| 24 | |
| 25 | grn_objcxx . . $ grn_obj# * |
| 26 | grn_proc_lexicon_opencxx . . $ grn_proc_lexicon_open(44e18c98336dc3bd).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 27 | grn_raw_stringcxx . . $ grn_raw_string# *tokenizer_raw, |
| 28 | grn_raw_stringcxx . . $ grn_raw_string# *normalizer_raw, |
| 29 | grn_raw_stringcxx . . $ grn_raw_string# *token_filters_raw, |
| 30 | grn_raw_stringcxx . . $ grn_raw_string# *extractors_raw, |
| 31 | const char *context_tag) |
| 32 | { |
| 33 | grn_objcxx . . $ grn_obj# *lexicon; |
| 34 | |
| 35 | lexicon = grn_table_createcxx . . $ grn_table_create(51df5019e8d3bdc1).(ctx, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, |
| 36 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 37 | GRN_OBJ_TABLE_HASH_KEYcxx . . $ `include/groonga/groonga.h:688:9`!, |
| 38 | grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, GRN_DB_SHORT_TEXTcxx . . $ GRN_DB_SHORT_TEXT.), |
| 39 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 40 | { |
| 41 | grn_objcxx . . $ grn_obj# tokenizer; |
| 42 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&tokenizer, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!); |
| 43 | if (tokenizer_raw) { |
| 44 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, &tokenizer, tokenizer_raw->value, tokenizer_raw->length); |
| 45 | } |
| 46 | grn_obj_set_infocxx . . $ grn_obj_set_info(1c4fe9650683f16e).(ctx, lexicon, GRN_INFO_DEFAULT_TOKENIZERcxx . . $ GRN_INFO_DEFAULT_TOKENIZER., &tokenizer); |
| 47 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &tokenizer); |
| 48 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 49 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, lexicon); |
| 50 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, ctx->rc, |
| 51 | "%s failed to set tokenizer: <%.*s>: %s", |
| 52 | context_tag, |
| 53 | (int)(tokenizer_raw->length), |
| 54 | tokenizer_raw->value, |
| 55 | ctx->errbuf); |
| 56 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | { |
| 61 | grn_objcxx . . $ grn_obj# normalizer; |
| 62 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&normalizer, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!); |
| 63 | if (normalizer_raw) { |
| 64 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, |
| 65 | &normalizer, |
| 66 | normalizer_raw->value, |
| 67 | normalizer_raw->length); |
| 68 | } |
| 69 | grn_obj_set_infocxx . . $ grn_obj_set_info(1c4fe9650683f16e).(ctx, lexicon, GRN_INFO_NORMALIZERcxx . . $ GRN_INFO_NORMALIZER., &normalizer); |
| 70 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &normalizer); |
| 71 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 72 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, lexicon); |
| 73 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, ctx->rc, |
| 74 | "%s failed to set normalizer: <%.*s>: %s", |
| 75 | context_tag, |
| 76 | (int)(normalizer_raw->length), |
| 77 | normalizer_raw->value, |
| 78 | ctx->errbuf); |
| 79 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | if (token_filters_raw) { |
| 84 | grn_proc_table_set_token_filterscxx . . $ grn_proc_table_set_token_filters(9ece0a636012bd6a).(ctx, lexicon, token_filters_raw); |
| 85 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 86 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, lexicon); |
| 87 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, ctx->rc, |
| 88 | "%s failed to set token filters: <%.*s>: %s", |
| 89 | context_tag, |
| 90 | (int)(token_filters_raw->length), |
| 91 | token_filters_raw->value, |
| 92 | ctx->errbuf); |
| 93 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | if (extractors_raw) { |
| 98 | grn_proc_table_set_extractorscxx . . $ grn_proc_table_set_extractors(9ece0a636012bd6a).(ctx, lexicon, extractors_raw); |
| 99 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 100 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, lexicon); |
| 101 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, ctx->rc, |
| 102 | "%s failed to set extractors: <%.*s>: %s", |
| 103 | context_tag, |
| 104 | (int)(extractors_raw->length), |
| 105 | extractors_raw->value, |
| 106 | ctx->errbuf); |
| 107 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | return lexicon; |
| 112 | } |