7.23.5. grn_column¶
7.23.5.1. 概要¶
TODO...
7.23.5.2. 例¶
TODO...
7.23.5.3. リファレンス¶
-
GRN_COLUMN_NAME_ID¶ 擬似カラム
_idの名前を返します。以下のように
GRN_COLUMN_NAME_ID_LENと一緒に使うと便利です:grn_obj *id_column; id_column = grn_ctx_get(ctx, GRN_COLUMN_NAME_ID, GRN_COLUMN_NAME_ID_LEN);
3.1.1から。
-
GRN_COLUMN_NAME_ID_LEN¶ It returns the byte size of
GRN_COLUMN_NAME_ID.3.1.1から。
-
GRN_COLUMN_NAME_KEY¶ It returns the name of 擬似カラム
_key.It is useful to use with
GRN_COLUMN_NAME_KEY_LENlike the following:grn_obj *key_column; key_column = grn_ctx_get(ctx, GRN_COLUMN_NAME_KEY, GRN_COLUMN_NAME_KEY_LEN);
3.1.1から。
-
GRN_COLUMN_NAME_KEY_LEN¶ It returns the byte size of
GRN_COLUMN_NAME_KEY.3.1.1から。
-
GRN_COLUMN_NAME_VALUE¶ It returns the name of 擬似カラム
_value.It is useful to use with
GRN_COLUMN_NAME_VALUE_LENlike the following:grn_obj *value_column; value_column = grn_ctx_get(ctx, GRN_COLUMN_NAME_VALUE, GRN_COLUMN_NAME_VALUE_LEN);
3.1.1から。
-
GRN_COLUMN_NAME_VALUE_LEN¶ It returns the byte size of
GRN_COLUMN_NAME_VALUE.3.1.1から。
-
GRN_COLUMN_NAME_SCORE¶ 擬似カラム
_scoreの名前を返します。以下のように
GRN_COLUMN_NAME_SCORE_LENと一緒に使うと便利です:grn_obj *score_column; score_column = grn_ctx_get(ctx, GRN_COLUMN_NAME_SCORE, GRN_COLUMN_NAME_SCORE_LEN);
3.1.1から。
-
GRN_COLUMN_NAME_SCORE_LEN¶ GRN_COLUMN_NAME_SCOREのサイズをバイト数で返します。3.1.1から。
-
GRN_COLUMN_NAME_NSUBRECS¶ 擬似カラム
_nsubrecsの名前を返します以下のように
GRN_COLUMN_NAME_NSUBRECS_LENと一緒に使うと便利です:grn_obj *nsubrecs_column; nsubrecs_column = grn_ctx_get(ctx, GRN_COLUMN_NAME_NSUBRECS, GRN_COLUMN_NAME_NSUBRECS_LEN);
3.1.1から。
-
GRN_COLUMN_NAME_NSUBRECS_LEN¶ GRN_COLUMN_NAME_NSUBRECSのサイズをバイト数で返す。3.1.1から。
-
grn_obj *
grn_column_create(grn_ctx *ctx, grn_obj *table, const char *name, unsigned int name_size, const char *path, grn_obj_flags flags, grn_obj *type)¶ tableに新たなカラムを定義します。nameは省略できません。一つのtableに同一のnameのcolumnを複数定義することはできません。
パラメータ: - table -- 対象tableを指定します。
- name -- カラム名を指定します。
- name_size -- nameパラメータのsize(byte)を指定します。
- path -- カラムを格納するファイルパスを指定します。
flagsに
GRN_OBJ_PERSISTENTが指定されている場合のみ有効です。 NULLなら自動的にファイルパスが付与されます。 - flags --
GRN_OBJ_PERSISTENTを指定すると永続columnとなります。GRN_OBJ_COLUMN_INDEXを指定すると転置インデックスとなります。GRN_OBJ_COLUMN_SCALARを指定するとスカラ値(単独の値)を格納します。GRN_OBJ_COLUMN_VECTORを指定すると値の配列を格納します。GRN_OBJ_COMPRESS_ZLIBを指定すると値をzlib圧縮して格納します。GRN_OBJ_COMPRESS_LZOを指定すると値をlzo圧縮して格納します。GRN_OBJ_COLUMN_INDEXと共にGRN_OBJ_WITH_SECTIONを指定すると、転置索引にsection(段落情報)を合わせて格納します。GRN_OBJ_COLUMN_INDEXと共にGRN_OBJ_WITH_WEIGHTを指定すると、転置索引にweight情報を合わせて格納します。GRN_OBJ_COLUMN_INDEXと共にGRN_OBJ_WITH_POSITIONを指定すると、転置索引に出現位置情報を合わせて格納します。 - type -- カラム値の型を指定します。定義済みのtypeあるいはtableを指定できます。
-
grn_rc
grn_column_index_update(grn_ctx *ctx, grn_obj *column, grn_id id, unsigned int section, grn_obj *oldvalue, grn_obj *newvalue)¶ oldvalue, newvalueの値から得られるキーに対応するcolumnの値の中の、id, sectionに対応するエントリを更新します。columnは
GRN_OBJ_COLUMN_INDEX型のカラムでなければなりません。パラメータ: - column -- 対象columnを指定します。
- id -- 対象レコードのIDを指定します。
- section -- 対象レコードのセクション番号を指定します。
- oldvalue -- 更新前の値を指定します。
- newvalue -- 更新後の値を指定します。
-
grn_obj *
grn_column_table(grn_ctx *ctx, grn_obj *column)¶ columnが属するtableを返します。
パラメータ: - column -- 対象columnを指定します。
-
grn_rc
grn_column_rename(grn_ctx *ctx, grn_obj *column, const char *name, unsigned int name_size)¶ ctxが使用するdbにおいてcolumnに対応する名前をnameに更新します。columnは永続オブジェクトでなければいけません。
パラメータ: - column -- 対象columnを指定します。
- name -- 新しい名前を指定します。
- name_size -- nameパラメータのsize(byte)を指定します。
-
int
grn_column_name(grn_ctx *ctx, grn_obj *obj, char *namebuf, int buf_size)¶ カラムobjの名前の長さを返します。buf_sizeの長さが名前の長さ以上であった場合は、namebufに該当する名前をコピーします。
パラメータ: - obj -- 対象objectを指定します。
- namebuf -- 名前を格納するバッファ(呼出側で準備する)を指定します。
- buf_size -- namebufのサイズ(byte長)を指定します。
-
int
grn_column_index(grn_ctx *ctx, grn_obj *column, grn_operator op, grn_obj **indexbuf, int buf_size, int *section)¶ columnに張られているindexのうち、opの操作を実行可能なものの数を返します。またそれらのidを、buf_sizeに指定された個数を上限としてindexbufに返します。
パラメータ: - column -- 対象のcolumnを指定します。
- op -- indexで実行したい操作を指定します。
- indexbuf -- indexを格納するバッファ(呼出側で準備する)を指定します。
- buf_size -- indexbufのサイズ(byte長)を指定します。
- section -- section番号を格納するint長バッファ(呼出側で準備する)を指定します。
-
grn_rc
grn_column_truncate(grn_ctx *ctx, grn_obj *column)¶ 注釈
This is a dangerous API. You must not use this API when other thread or process accesses the target column. If you use this API against shared column, the process that accesses the column may be broken and the column may be broken.
バージョン 4.0.9 で追加.
Clears all values in the column.
パラメータ: - column -- truncate対象のカラム。
戻り値: 成功時は
GRN_SUCCESS、エラー時はGRN_SUCCESS以外。