Groonga
Loading...
Searching...
No Matches
extractor.h File Reference
Include dependency graph for extractor.h:

Go to the source code of this file.

Typedefs

typedef struct grn_extract_data grn_extract_data
 This is an opaque data to pass data to an extractor from Groonga.
 
typedef grn_objgrn_extractor_extract_func(grn_ctx *ctx, grn_obj *extractor, grn_extract_data *data)
 A function that implements extraction feature for an extractor.
 

Functions

GRN_PLUGIN_EXPORT grn_objgrn_extract_data_get_value (grn_ctx *ctx, grn_extract_data *data)
 Return the extract target value.
 
GRN_PLUGIN_EXPORT grn_objgrn_extract_data_get_table (grn_ctx *ctx, grn_extract_data *data)
 Return the table that extracts target value belongs to.
 
GRN_PLUGIN_EXPORT uint32_t grn_extract_data_get_index (grn_ctx *ctx, grn_extract_data *data)
 Return the index of the target extractor in the table.
 
GRN_PLUGIN_EXPORT grn_objgrn_extractor_create (grn_ctx *ctx, const char *name, int name_length)
 Create an extractor.
 
GRN_PLUGIN_EXPORT grn_rc grn_extractor_set_extract_func (grn_ctx *ctx, grn_obj *extractor, grn_extractor_extract_func *extract)
 Set an extract function to an extractor.
 

Typedef Documentation

◆ grn_extract_data

This is an opaque data to pass data to an extractor from Groonga.

This is used for grn_extractor_extract_func.

See also
grn_extractor_set_extract_func
Since
16.0.1

◆ grn_extractor_extract_func

typedef grn_obj * grn_extractor_extract_func(grn_ctx *ctx, grn_obj *extractor, grn_extract_data *data)

A function that implements extraction feature for an extractor.

If the extractor can extract a content from the data, the extractor must extract a content from the data and return it as a grn_obj that is created by grn_obj_open.

If the extractor can't extract a content from the data, the extractor must return NULL.

Parameters
ctxThe context object.
extractorThe extractor.
dataThe data to be extracted.
Returns
The extracted value as a grn_obj, NULL if the extractor doesn't extract anything or has any error.

You must free the returned value by GRN_OBJ_FIN when it's no longer needed.

Since
16.0.1

Function Documentation

◆ grn_extract_data_get_index()

GRN_PLUGIN_EXPORT uint32_t grn_extract_data_get_index ( grn_ctx ctx,
grn_extract_data data 
)

Return the index of the target extractor in the table.

Parameters
ctxThe context object.
dataThe data.
Returns
The index of the target extractor in the table.
Since
16.0.1

◆ grn_extract_data_get_table()

GRN_PLUGIN_EXPORT grn_obj * grn_extract_data_get_table ( grn_ctx ctx,
grn_extract_data data 
)

Return the table that extracts target value belongs to.

Parameters
ctxThe context object.
dataThe data.
Returns
The table that extract target value belongs to.
Since
16.0.1

◆ grn_extract_data_get_value()

GRN_PLUGIN_EXPORT grn_obj * grn_extract_data_get_value ( grn_ctx ctx,
grn_extract_data data 
)

Return the extract target value.

This is owned by grn_extract_data. You must not free it.

Parameters
ctxThe context object.
dataThe data.
Returns
The extract target value.
Since
16.0.1

◆ grn_extractor_create()

GRN_PLUGIN_EXPORT grn_obj * grn_extractor_create ( grn_ctx ctx,
const char *  name,
int  name_length 
)

Create an extractor.

You must set at least an extract function to the created extractor by grn_extractor_set_extract_func.

Parameters
ctxThe context object.
nameThe name of the new extractor.
name_lengthThe byte size of name.You can use -1 if name is a \0-terminated string.
Returns
The next extractor.
Since
16.0.1

◆ grn_extractor_set_extract_func()

GRN_PLUGIN_EXPORT grn_rc grn_extractor_set_extract_func ( grn_ctx ctx,
grn_obj extractor,
grn_extractor_extract_func extract 
)

Set an extract function to an extractor.

Parameters
ctxThe context object.
extractorThe extractor.
extractThe function to extract a content.
Returns
GRN_SUCCESS on success, the appropriate grn_rc on error.
Since
16.0.1