• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GRN_TEXT_VALUE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GRN_TEXT_VALUE函数的典型用法代码示例。如果您正苦于以下问题:C++ GRN_TEXT_VALUE函数的具体用法?C++ GRN_TEXT_VALUE怎么用?C++ GRN_TEXT_VALUE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GRN_TEXT_VALUE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: report_set_column_value_failure

static void
report_set_column_value_failure(grn_ctx *ctx,
                                grn_obj *key,
                                const char *column_name,
                                unsigned int column_name_size,
                                grn_obj *column_value)
{
  grn_obj key_inspected, column_value_inspected;

  GRN_TEXT_INIT(&key_inspected, 0);
  GRN_TEXT_INIT(&column_value_inspected, 0);
  grn_inspect_limited(ctx, &key_inspected, key);
  grn_inspect_limited(ctx, &column_value_inspected, column_value);
  GRN_LOG(ctx, GRN_LOG_ERROR,
          "[table][load] failed to set column value: %s: "
          "key: <%.*s>, column: <%.*s>, value: <%.*s>",
          ctx->errbuf,
          (int)GRN_TEXT_LEN(&key_inspected),
          GRN_TEXT_VALUE(&key_inspected),
          column_name_size,
          column_name,
          (int)GRN_TEXT_LEN(&column_value_inspected),
          GRN_TEXT_VALUE(&column_value_inspected));
  GRN_OBJ_FIN(ctx, &key_inspected);
  GRN_OBJ_FIN(ctx, &column_value_inspected);
}
开发者ID:cosmo0920,项目名称:groonga,代码行数:26,代码来源:load.c


示例2: command_echo

static grn_obj *
command_echo(grn_ctx *ctx, GNUC_UNUSED int nargs, GNUC_UNUSED grn_obj **args,
             grn_user_data *user_data)
{
  grn_obj *var;

  char *input = NULL;
  unsigned int input_len = 0;

  var = grn_plugin_proc_get_var(ctx, user_data, "input", -1);

  GRN_PLUGIN_LOG(ctx, GRN_LOG_NOTICE, "[echo] input = %.*s",
                 (int)GRN_TEXT_LEN(var), GRN_TEXT_VALUE(var));

  if(GRN_TEXT_LEN(var) != 0) {
    input = GRN_TEXT_VALUE(var);
    input_len = GRN_TEXT_LEN(var);
  }

  grn_ctx_output_array_open(ctx, "RESULT", 2);
  grn_ctx_output_cstr(ctx, input);
  grn_ctx_output_int64(ctx, input_len);
  grn_ctx_output_array_close(ctx);

  return NULL;
}
开发者ID:naoa,项目名称:groonga-command-sample,代码行数:26,代码来源:echo.c


示例3: command_ruby_eval

static grn_obj *
command_ruby_eval(grn_ctx *ctx, int nargs, grn_obj **args,
                  grn_user_data *user_data)
{
  grn_obj *script;
  mrb_value result;

  script = VAR(0);
  switch (script->header.domain) {
  case GRN_DB_SHORT_TEXT :
  case GRN_DB_TEXT :
  case GRN_DB_LONG_TEXT :
    break;
  default :
    {
      grn_obj inspected;
      GRN_TEXT_INIT(&inspected, 0);
      grn_inspect(ctx, &inspected, script);
      ERR(GRN_INVALID_ARGUMENT, "script must be a string: <%.*s>",
          (int)GRN_TEXT_LEN(&inspected), GRN_TEXT_VALUE(&inspected));
      GRN_OBJ_FIN(ctx, &inspected);
      return NULL;
    }
    break;
  }

  result = grn_mrb_eval(ctx, GRN_TEXT_VALUE(script), GRN_TEXT_LEN(script));
  output_result(ctx, result);

  return NULL;
}
开发者ID:wanabe,项目名称:groonga,代码行数:31,代码来源:eval.c


示例4: proc_table_create

static grn_obj *
proc_table_create(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
{
    uint32_t nvars;
    grn_obj *buf = args[0];
    grn_expr_var *vars;
    grn_proc_get_info(ctx, user_data, &vars, &nvars, NULL);
    if (nvars == 6) {
        grn_obj *table;
        grn_obj_flags flags = grn_atoi(GRN_TEXT_VALUE(&vars[1].value),
                                       GRN_BULK_CURR(&vars[1].value), NULL);
        if (GRN_TEXT_LEN(&vars[0].value)) {
            flags |= GRN_OBJ_PERSISTENT;
        }
        table = grn_table_create(ctx,
                                 GRN_TEXT_VALUE(&vars[0].value),
                                 GRN_TEXT_LEN(&vars[0].value),
                                 NULL, flags,
                                 grn_ctx_get(ctx, GRN_TEXT_VALUE(&vars[2].value),
                                             GRN_TEXT_LEN(&vars[2].value)),
                                 grn_ctx_get(ctx, GRN_TEXT_VALUE(&vars[3].value),
                                             GRN_TEXT_LEN(&vars[3].value)));
        if (table) {
            grn_obj_set_info(ctx, table,
                             GRN_INFO_DEFAULT_TOKENIZER,
                             grn_ctx_get(ctx, GRN_TEXT_VALUE(&vars[4].value),
                                         GRN_TEXT_LEN(&vars[4].value)));
            grn_obj_unlink(ctx, table);
        }
        GRN_TEXT_PUTS(ctx, buf, ctx->rc ? "false" : "true");
    }
    return buf;
}
开发者ID:hayamiz,项目名称:groonga,代码行数:33,代码来源:proc.c


示例5: snippet_exec

static grn_obj *
snippet_exec(grn_ctx *ctx, grn_obj *snip, grn_obj *text,
             grn_user_data *user_data,
             const char *prefix, int prefix_length,
             const char *suffix, int suffix_length)
{
  grn_rc rc;
  unsigned int i, n_results, max_tagged_length;
  grn_obj snippet_buffer;
  grn_obj *snippets;

  if (GRN_TEXT_LEN(text) == 0) {
    return NULL;
  }

  rc = grn_snip_exec(ctx, snip,
                     GRN_TEXT_VALUE(text), GRN_TEXT_LEN(text),
                     &n_results, &max_tagged_length);
  if (rc != GRN_SUCCESS) {
    return NULL;
  }

  if (n_results == 0) {
    return grn_plugin_proc_alloc(ctx, user_data, GRN_DB_VOID, 0);
  }

  snippets = grn_plugin_proc_alloc(ctx, user_data, GRN_DB_SHORT_TEXT, GRN_OBJ_VECTOR);
  if (!snippets) {
    return NULL;
  }

  GRN_TEXT_INIT(&snippet_buffer, 0);
  grn_bulk_space(ctx, &snippet_buffer,
                 prefix_length + max_tagged_length + suffix_length);
  for (i = 0; i < n_results; i++) {
    unsigned int snippet_length;

    GRN_BULK_REWIND(&snippet_buffer);
    if (prefix_length) {
      GRN_TEXT_PUT(ctx, &snippet_buffer, prefix, prefix_length);
    }
    rc = grn_snip_get_result(ctx, snip, i,
                             GRN_TEXT_VALUE(&snippet_buffer) + prefix_length,
                             &snippet_length);
    if (rc == GRN_SUCCESS) {
      grn_strncat(GRN_TEXT_VALUE(&snippet_buffer),
                  GRN_BULK_WSIZE(&snippet_buffer),
                  suffix,
                  suffix_length);
      grn_vector_add_element(ctx, snippets,
                             GRN_TEXT_VALUE(&snippet_buffer),
                             prefix_length + snippet_length + suffix_length,
                             0, GRN_DB_SHORT_TEXT);
    }
  }
  GRN_OBJ_FIN(ctx, &snippet_buffer);

  return snippets;
}
开发者ID:cafedomancer,项目名称:groonga,代码行数:59,代码来源:proc_snippet.c


示例6: parse_synonyms_file_line

static void
parse_synonyms_file_line(grn_ctx *ctx, const char *line, size_t line_length,
                         grn_obj *key, grn_obj *value)
{
  size_t i = 0;

  if (is_comment_mark(line[i])) {
    return;
  }

  while (i < line_length) {
    char character = line[i];
    i++;
    if (character == '\t') {
      break;
    }
    GRN_TEXT_PUTC(ctx, key, character);
  }

  if (i == line_length) {
    return;
  }

  GRN_TEXT_PUTS(ctx, value, "((");
  while (i < line_length) {
    char character = line[i];
    i++;
    if (character == '\t') {
      GRN_TEXT_PUTS(ctx, value, ") OR (");
    } else {
      GRN_TEXT_PUTC(ctx, value, character);
    }
  }
  GRN_TEXT_PUTS(ctx, value, "))");

  {
    grn_id id;
    void *value_location = NULL;

    id = grn_hash_add(ctx, synonyms, GRN_TEXT_VALUE(key), GRN_TEXT_LEN(key),
                      &value_location, NULL);
    if (id == GRN_ID_NIL) {
      GRN_PLUGIN_LOG(ctx, GRN_LOG_WARNING,
                     "[plugin][query-expander][tsv] "
                     "failed to register key: <%.*s>",
                     (int)GRN_TEXT_LEN(key), GRN_TEXT_VALUE(key));
      return;
    }

    if (GRN_TEXT_LEN(value) <= MAX_SYNONYM_BYTES - 1) {
      GRN_TEXT_PUTC(ctx, value, '\0');
    } else {
      grn_bulk_truncate(ctx, value, MAX_SYNONYM_BYTES - 1);
      GRN_TEXT_PUTC(ctx, value, '\0');
    }
    grn_memcpy(value_location, GRN_TEXT_VALUE(value), GRN_TEXT_LEN(value));
  }
}
开发者ID:cosmo0920,项目名称:groonga,代码行数:58,代码来源:tsv.c


示例7: grn_token_cursor_next_apply_token_filters

static int
grn_token_cursor_next_apply_token_filters(grn_ctx *ctx,
                                          grn_token_cursor *token_cursor,
                                          grn_obj *current_token_data,
                                          grn_obj *status)
{
  grn_obj *token_filters = token_cursor->token_filter.objects;
  unsigned int i, n_token_filters;
  grn_token current_token;
  grn_token next_token;

  if (token_filters) {
    n_token_filters = GRN_BULK_VSIZE(token_filters) / sizeof(grn_obj *);
  } else {
    n_token_filters = 0;
  }

  GRN_TEXT_INIT(&(current_token.data), GRN_OBJ_DO_SHALLOW_COPY);
  GRN_TEXT_SET(ctx, &(current_token.data),
               GRN_TEXT_VALUE(current_token_data),
               GRN_TEXT_LEN(current_token_data));
  current_token.status = GRN_INT32_VALUE(status);
  GRN_TEXT_INIT(&(next_token.data), GRN_OBJ_DO_SHALLOW_COPY);
  GRN_TEXT_SET(ctx, &(next_token.data),
               GRN_TEXT_VALUE(&(current_token.data)),
               GRN_TEXT_LEN(&(current_token.data)));
  next_token.status = current_token.status;

  for (i = 0; i < n_token_filters; i++) {
    grn_obj *token_filter_object = GRN_PTR_VALUE_AT(token_filters, i);
    grn_proc *token_filter = (grn_proc *)token_filter_object;
    void *data = token_cursor->token_filter.data[i];

#define SKIP_FLAGS\
    (GRN_TOKEN_SKIP |\
     GRN_TOKEN_SKIP_WITH_POSITION)
    if (current_token.status & SKIP_FLAGS) {
      break;
    }
#undef SKIP_FLAGS

    token_filter->callbacks.token_filter.filter(ctx,
                                                &current_token,
                                                &next_token,
                                                data);
    GRN_TEXT_SET(ctx, &(current_token.data),
                 GRN_TEXT_VALUE(&(next_token.data)),
                 GRN_TEXT_LEN(&(next_token.data)));
    current_token.status = next_token.status;
  }

  token_cursor->curr =
    (const unsigned char *)GRN_TEXT_VALUE(&(current_token.data));
  token_cursor->curr_size = GRN_TEXT_LEN(&(current_token.data));

  return current_token.status;
}
开发者ID:digideskio,项目名称:groonga,代码行数:57,代码来源:token_cursor.c


示例8: rb_grn_bulk_to_ruby_object_by_range_id

static VALUE
rb_grn_bulk_to_ruby_object_by_range_id (grn_ctx *context, grn_obj *bulk,
					grn_id range_id,
					VALUE related_object, VALUE *rb_value)
{
    grn_bool success = GRN_TRUE;

    switch (range_id) {
      case GRN_DB_VOID:
	*rb_value = rb_str_new(GRN_TEXT_VALUE(bulk), GRN_TEXT_LEN(bulk));
	break;
      case GRN_DB_BOOL:
	*rb_value = GRN_BOOL_VALUE(bulk) ? Qtrue : Qfalse;
	break;
      case GRN_DB_INT32:
	*rb_value = INT2NUM(GRN_INT32_VALUE(bulk));
	break;
      case GRN_DB_UINT32:
	*rb_value = UINT2NUM(GRN_UINT32_VALUE(bulk));
	break;
      case GRN_DB_INT64:
	*rb_value = LL2NUM(GRN_INT64_VALUE(bulk));
	break;
      case GRN_DB_UINT64:
	*rb_value = ULL2NUM(GRN_UINT64_VALUE(bulk));
	break;
      case GRN_DB_FLOAT:
	*rb_value = rb_float_new(GRN_FLOAT_VALUE(bulk));
	break;
      case GRN_DB_TIME:
	{
	    int64_t time_value, sec, usec;

	    time_value = GRN_TIME_VALUE(bulk);
	    GRN_TIME_UNPACK(time_value, sec, usec);
	    *rb_value = rb_funcall(rb_cTime, rb_intern("at"), 2,
				   LL2NUM(sec), LL2NUM(usec));
	}
	break;
      case GRN_DB_SHORT_TEXT:
      case GRN_DB_TEXT:
      case GRN_DB_LONG_TEXT:
	*rb_value = rb_grn_context_rb_string_new(context,
						 GRN_TEXT_VALUE(bulk),
						 GRN_TEXT_LEN(bulk));
	break;
      default:
	success = GRN_FALSE;
	break;
    }

    return success;
}
开发者ID:ryoqun,项目名称:rroonga,代码行数:53,代码来源:rb-grn-utils.c


示例9: command_tag_synonym_delete

static grn_obj *
command_tag_synonym_delete(grn_ctx *ctx, GNUC_UNUSED int nargs, GNUC_UNUSED grn_obj **args,
                           grn_user_data *user_data)
{
  grn_obj *var, *table, *column;
  unsigned int nhooks = 0;
  char *table_name = NULL;
  unsigned int table_len = 0;
  char *column_name = NULL;
  unsigned int column_len = 0;

  var = grn_plugin_proc_get_var(ctx, user_data, "table", -1);
  if (GRN_TEXT_LEN(var) != 0) {
    table_name = GRN_TEXT_VALUE(var);
    table_len = GRN_TEXT_LEN(var);
  }
  var = grn_plugin_proc_get_var(ctx, user_data, "column", -1);
  if (GRN_TEXT_LEN(var) != 0) {
    column_name = GRN_TEXT_VALUE(var);
    column_len = GRN_TEXT_LEN(var);
  }
  table = grn_ctx_get(ctx, table_name, table_len);
  column = grn_obj_column(ctx, table, column_name, column_len);

  nhooks = grn_obj_get_nhooks(ctx, column, GRN_HOOK_SET);
  if (nhooks) {
    grn_obj *hook;
    unsigned int i;
    grn_obj data;
    grn_obj buf;
    GRN_TEXT_INIT(&buf, 0);
    GRN_TEXT_INIT(&data, 0);
    for (i=0; i < nhooks; i++) {
      GRN_BULK_REWIND(&buf);
      GRN_BULK_REWIND(&data);
      hook = grn_obj_get_hook(ctx, column, GRN_HOOK_SET, i, &data);
      grn_inspect_name(ctx, &buf, hook);
      if (GRN_TEXT_LEN(&buf) == strlen("tag_synonym") &&
          strncmp(GRN_TEXT_VALUE(&buf), "tag_synonym", GRN_TEXT_LEN(&buf)) == 0) {
        grn_obj_delete_hook(ctx, column, GRN_HOOK_SET, i);
        break;
      }
    }
    grn_obj_unlink(ctx, &data);
    grn_obj_unlink(ctx, &buf);
  }
  nhooks = grn_obj_get_nhooks(ctx, column, GRN_HOOK_SET);
  //grn_ctx_output_array_open(ctx, "RESULT", 1);
  grn_ctx_output_int32(ctx, nhooks);
  //grn_ctx_output_array_close(ctx);

  return NULL;
}
开发者ID:naoa,项目名称:groonga-tag-synonym,代码行数:53,代码来源:tag_synonym.c


示例10: exec_text_operator_text_text

static grn_bool
exec_text_operator_text_text(grn_ctx *ctx,
                             grn_operator op,
                             grn_obj *target,
                             grn_obj *query)
{
  return exec_text_operator_raw_text_raw_text(ctx,
                                              op,
                                              GRN_TEXT_VALUE(target),
                                              GRN_TEXT_LEN(target),
                                              GRN_TEXT_VALUE(query),
                                              GRN_TEXT_LEN(query));
}
开发者ID:groonga,项目名称:groonga,代码行数:13,代码来源:operator.c


示例11: stem_filter

static void
stem_filter(grn_ctx *ctx,
            grn_token *current_token,
            grn_token *next_token,
            void *user_data)
{
  grn_stem_token_filter *token_filter = user_data;
  grn_obj *data;

  if (GRN_CTX_GET_ENCODING(ctx) != GRN_ENC_UTF8) {
    return;
  }

  data = grn_token_get_data(ctx, current_token);

  if (token_filter->stemmer) {
    sb_stemmer_delete(token_filter->stemmer);
  }
  {
    /* TODO: Detect algorithm from the current token. */
    const char *algorithm = "english";
    const char *encoding = "UTF_8";
    token_filter->stemmer = sb_stemmer_new(algorithm, encoding);
    if (!token_filter->stemmer) {
      GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT,
                       "[token-filter][stem] "
                       "failed to create stemmer: "
                       "algorithm=<%s>, encoding=<%s>",
                       algorithm, encoding);
      return;
    }
  }

  {
    const sb_symbol *stemmed;

    stemmed = sb_stemmer_stem(token_filter->stemmer,
                              GRN_TEXT_VALUE(data), GRN_TEXT_LEN(data));
    if (stemmed) {
      grn_token_set_data(ctx, next_token,
                         stemmed,
                         sb_stemmer_length(token_filter->stemmer));
    } else {
      GRN_PLUGIN_ERROR(ctx, GRN_NO_MEMORY_AVAILABLE,
                       "[token-filter][stem] "
                       "failed to allocate memory for stemmed word: <%.*s>",
                       (int)GRN_TEXT_LEN(data), GRN_TEXT_VALUE(data));
      return;
    }
  }
}
开发者ID:tamano,项目名称:groonga,代码行数:51,代码来源:stem.c


示例12: func_snippet_tritonn

static grn_obj *
func_snippet_tritonn(grn_ctx *ctx, int nargs, grn_obj **args,
                  grn_user_data *user_data)
{
  grn_obj *snippets = NULL;

  if (nargs > 10) {
    grn_obj *text = args[0];
    grn_obj *snip = NULL;
    unsigned int width = GRN_UINT64_VALUE(args[1]);
    unsigned int max_n_results = GRN_UINT64_VALUE(args[2]);
    grn_snip_mapping *mapping = NULL;

    int flags = GRN_SNIP_COPY_TAG;

    if(GRN_UINT64_VALUE(args[4])){
      flags |= GRN_SNIP_SKIP_LEADING_SPACES;
    }
    if(GRN_UINT64_VALUE(args[5])){
      mapping = GRN_SNIP_MAPPING_HTML_ESCAPE;
    }
    snip = grn_snip_open(ctx, flags, width, max_n_results, "", 0, "", 0, mapping);

    if (snip) {
      grn_rc rc;
      unsigned int i;

      if(GRN_TEXT_LEN(args[3])){
        grn_obj * normalizer;
        normalizer = grn_ctx_get(ctx, GRN_TEXT_VALUE(args[3]), GRN_TEXT_LEN(args[3]));
        grn_snip_set_normalizer(ctx, snip, normalizer); 
      }

      for(i = 8; i < (unsigned int)nargs; i += 3){
        rc = grn_snip_add_cond(ctx, snip,
                               GRN_TEXT_VALUE(args[i]), GRN_TEXT_LEN(args[i]),
                               GRN_TEXT_VALUE(args[i + 1]), GRN_TEXT_LEN(args[i + 1]),
                               GRN_TEXT_VALUE(args[i + 2]), GRN_TEXT_LEN(args[i + 2]));
      }

      snippets = snippet_exec(ctx, snip, text, user_data, args);
      grn_obj_close(ctx, snip);
    }
  }
  if(!snippets){
    snippets = grn_plugin_proc_alloc(ctx, user_data, GRN_DB_VOID, 0);
  }

  return snippets;
}
开发者ID:naoa,项目名称:groonga-function-snippet_tritonn,代码行数:50,代码来源:snippet_tritonn.c


示例13: proc_column_create

static grn_obj *
proc_column_create(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
{
    uint32_t nvars;
    grn_obj *buf = args[0];
    grn_expr_var *vars;
    grn_proc_get_info(ctx, user_data, &vars, &nvars, NULL);
    if (nvars == 6) {
        grn_obj_flags flags = grn_atoi(GRN_TEXT_VALUE(&vars[2].value),
                                       GRN_BULK_CURR(&vars[2].value), NULL);
        grn_obj *column, *table = grn_ctx_get(ctx, GRN_TEXT_VALUE(&vars[0].value),
                                              GRN_TEXT_LEN(&vars[0].value));
        grn_obj *type = grn_ctx_get(ctx, GRN_TEXT_VALUE(&vars[3].value),
                                    GRN_TEXT_LEN(&vars[3].value));
        if (GRN_TEXT_LEN(&vars[1].value)) {
            flags |= GRN_OBJ_PERSISTENT;
        }
        column = grn_column_create(ctx, table,
                                   GRN_TEXT_VALUE(&vars[1].value),
                                   GRN_TEXT_LEN(&vars[1].value),
                                   NULL, flags, type);
        if (column) {
            if (GRN_TEXT_LEN(&vars[4].value)) {
                grn_obj sources, source_ids, **p, **pe;
                GRN_PTR_INIT(&sources, GRN_OBJ_VECTOR, GRN_ID_NIL);
                GRN_UINT32_INIT(&source_ids, GRN_OBJ_VECTOR);
                grn_obj_columns(ctx, type,
                                GRN_TEXT_VALUE(&vars[4].value),
                                GRN_TEXT_LEN(&vars[4].value),
                                &sources);
                p = (grn_obj **)GRN_BULK_HEAD(&sources);
                pe = (grn_obj **)GRN_BULK_CURR(&sources);
                while (p < pe) {
                    grn_id source_id = grn_obj_id(ctx, *p++);
                    if (source_id) {
                        GRN_UINT32_PUT(ctx, &source_ids, source_id);
                    }
                }
                if (GRN_BULK_VSIZE(&source_ids)) {
                    grn_obj_set_info(ctx, column, GRN_INFO_SOURCE, &source_ids);
                }
                GRN_OBJ_FIN(ctx, &source_ids);
                GRN_OBJ_FIN(ctx, &sources);
            }
            grn_obj_unlink(ctx, column);
        }
        GRN_TEXT_PUTS(ctx, buf, ctx->rc ? "false" : "true");
    }
    return buf;
}
开发者ID:hayamiz,项目名称:groonga,代码行数:50,代码来源:proc.c


示例14: proc_define_selector

static grn_obj *
proc_define_selector(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
{
    uint32_t nvars;
    grn_expr_var *vars;
    grn_obj *outbuf = args[0];
    grn_proc_get_info(ctx, user_data, &vars, &nvars, NULL);
    if (grn_proc_create(ctx,
                        GRN_TEXT_VALUE(&vars[0].value),
                        GRN_TEXT_LEN(&vars[0].value),
                        NULL, proc_select, NULL, NULL, nvars - 1, vars + 1)) {
        GRN_TEXT_PUT(ctx, outbuf, GRN_TEXT_VALUE(&vars[0].value), GRN_TEXT_LEN(&vars[0].value));
    }
    return outbuf;
}
开发者ID:hayamiz,项目名称:groonga,代码行数:15,代码来源:proc.c


示例15: rb_grn_view_record_new

VALUE
rb_grn_view_record_new (VALUE view, grn_obj *id)
{
    return rb_grn_view_record_new_raw(view,
                                      rb_str_new(GRN_TEXT_VALUE(id),
                                                 GRN_TEXT_LEN(id)));
}
开发者ID:iwaim,项目名称:rroonga,代码行数:7,代码来源:rb-grn-view-record.c


示例16: ngx_http_groonga_grn_obj_to_ngx_buf

static ngx_buf_t *
ngx_http_groonga_grn_obj_to_ngx_buf(ngx_pool_t *pool, grn_obj *object)
{
  ngx_buf_t *buffer;
  buffer = ngx_pcalloc(pool, sizeof(ngx_buf_t));
  if (buffer == NULL) {
    return NULL;
  }

  /* adjust the pointers of the buffer */
  buffer->pos = (u_char *)GRN_TEXT_VALUE(object);
  buffer->last = (u_char *)GRN_TEXT_VALUE(object) + GRN_TEXT_LEN(object);
  buffer->memory = 1;    /* this buffer is in memory */

  return buffer;
}
开发者ID:pombredanne,项目名称:groonga,代码行数:16,代码来源:ngx_http_groonga_module.c


示例17: rb_grn_expression_inspect

/*
 * call-seq:
 *   _expression_.inspect -> String
 *
 * _expression_の中身を人に見やすい文字列で返す。
 */
static VALUE
rb_grn_expression_inspect (VALUE self)
{
    grn_ctx *context = NULL;
    grn_obj inspected;
    grn_obj *expression;
    VALUE rb_inspected;

    rb_grn_expression_deconstruct(SELF(self), &expression, &context,
                                  NULL, NULL,
                                  NULL, NULL, NULL);

    GRN_TEXT_INIT(&inspected, 0);
    GRN_TEXT_PUTS(context, &inspected, "#<Groonga::Expression ");
#ifdef WIN32
    GRN_TEXT_PUTS(context, &inspected, "(not supported on Windows)");
#else
    grn_expr_inspect(context, &inspected, expression);
#endif
    GRN_TEXT_PUTS(context, &inspected, ">");
    rb_inspected = rb_grn_context_rb_string_new(context,
						GRN_TEXT_VALUE(&inspected),
						GRN_TEXT_LEN(&inspected));
    GRN_OBJ_FIN(context, &inspected);

    return rb_inspected;
}
开发者ID:mallowlabs,项目名称:rroonga,代码行数:33,代码来源:rb-grn-expression.c


示例18: delimited_init

static grn_obj *
delimited_init(grn_ctx *ctx, grn_obj *table, grn_user_data *user_data,
               uint8_t *delimiter, uint32_t delimiter_len)
{
  grn_obj *str;
  int nflags = 0;
  grn_delimited_tokenizer *token;
  grn_obj_flags table_flags;
  if (!(str = grn_ctx_pop(ctx))) {
    ERR(GRN_INVALID_ARGUMENT, "missing argument");
    return NULL;
  }
  if (!(token = GRN_MALLOC(sizeof(grn_delimited_tokenizer)))) { return NULL; }
  user_data->ptr = token;
  token->delimiter = delimiter;
  token->delimiter_len = delimiter_len;
  token->pos = 0;
  grn_table_get_info(ctx, table, &table_flags, &token->encoding, NULL);
  nflags |= (table_flags & GRN_OBJ_KEY_NORMALIZE);
  if (!(token->nstr = grn_str_open_(ctx, GRN_TEXT_VALUE(str), GRN_TEXT_LEN(str),
                                    nflags, token->encoding))) {
    GRN_FREE(token);
    ERR(GRN_TOKENIZER_ERROR, "grn_str_open failed at grn_token_open");
    return NULL;
  }
  token->next = (unsigned char *)token->nstr->norm;
  token->end = token->next + token->nstr->norm_blen;
  token->len = token->nstr->length;
  GRN_TEXT_INIT(&token->curr_, GRN_OBJ_DO_SHALLOW_COPY);
  GRN_UINT32_INIT(&token->stat_, 0);
  return NULL;
}
开发者ID:ryoqun,项目名称:groonga,代码行数:32,代码来源:token.c


示例19: escape

MRN_API char *mroonga_escape(UDF_INIT *initid, UDF_ARGS *args, char *result,
                             unsigned long *length, char *is_null, char *error)
{
  EscapeInfo *info = (EscapeInfo *)initid->ptr;
  grn_ctx *ctx = &(info->ctx);

  if (!args->args[0]) {
    *is_null = 1;
    return NULL;
  }

  *is_null = 0;

  escape(info, args);

  if (ctx->rc) {
    my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0));
    goto error;
  }

  *length = GRN_TEXT_LEN(&(info->escaped_query));
  return (char *)(GRN_TEXT_VALUE(&(info->escaped_query)));

error:
  *error = 1;
  return NULL;
}
开发者ID:skyformat99,项目名称:mroonga,代码行数:27,代码来源:mrn_udf_escape.cpp


示例20: suggest_result

static int
suggest_result(struct evbuffer *res_buf, const char *types, const char *query,
               const char *target_name, int threshold, int limit,
               grn_obj *cmd_buf, grn_ctx *ctx)
{
  if (target_name && types && query) {
    GRN_BULK_REWIND(cmd_buf);
    GRN_TEXT_PUTS(ctx, cmd_buf, "/d/suggest?table=item_");
    grn_text_urlenc(ctx, cmd_buf, target_name, strlen(target_name));
    GRN_TEXT_PUTS(ctx, cmd_buf, "&column=kana&types=");
    grn_text_urlenc(ctx, cmd_buf, types, strlen(types));
    GRN_TEXT_PUTS(ctx, cmd_buf, "&query=");
    grn_text_urlenc(ctx, cmd_buf, query, strlen(query));
    GRN_TEXT_PUTS(ctx, cmd_buf, "&threshold=");
    grn_text_itoa(ctx, cmd_buf, threshold);
    GRN_TEXT_PUTS(ctx, cmd_buf, "&limit=");
    grn_text_itoa(ctx, cmd_buf, limit);
    {
      char *res;
      int flags;
      unsigned int res_len;

      grn_ctx_send(ctx, GRN_TEXT_VALUE(cmd_buf), GRN_TEXT_LEN(cmd_buf), 0);
      grn_ctx_recv(ctx, &res, &res_len, &flags);

      evbuffer_add(res_buf, res, res_len);
      return res_len;
    }
  } else {
    evbuffer_add(res_buf, "{}", 2);
    return 2;
  }
}
开发者ID:fusuian,项目名称:groonga,代码行数:33,代码来源:groonga_suggest_httpd.c



注:本文中的GRN_TEXT_VALUE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GROUP_AT函数代码示例发布时间:2022-05-30
下一篇:
C++ GRN_TEXT_PUTS函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap