Groonga
Loading...
Searching...
No Matches
table.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2009-2018 Brazil
3 Copyright (C) 2018-2026 Sutou Kouhei <kou@clear-code.com>
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#pragma once
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#define GRN_TABLE_MAX_KEY_SIZE (0x1000)
27
58 const char *name,
59 unsigned int name_size,
60 const char *path,
61 grn_table_flags flags,
62 grn_obj *key_type,
63 grn_obj *value_type);
66 const char *name,
67 uint32_t name_size,
68 const char *path,
69 grn_obj *base_table);
70
71#define GRN_TABLE_OPEN_OR_CREATE(ctx, \
72 name, \
73 name_size, \
74 path, \
75 flags, \
76 key_type, \
77 value_type, \
78 table) \
79 (((table) = grn_ctx_get((ctx), (name), (name_size))) || \
80 ((table) = grn_table_create((ctx), \
81 (name), \
82 (name_size), \
83 (path), \
84 (flags), \
85 (key_type), \
86 (value_type))))
105 grn_obj *table,
106 const void *key,
107 unsigned int key_size,
108 int *added);
109
126 grn_obj *table,
127 const void *key,
128 unsigned int key_size);
159 grn_obj *table,
160 const void *key,
161 unsigned int key_size);
175GRN_API int
177 grn_ctx *ctx, grn_obj *table, grn_id id, void *keybuf, int buf_size);
192 grn_obj *table,
193 const void *key,
194 unsigned int key_size);
224 grn_obj *table,
225 grn_id id,
226 const void *dest_key,
227 unsigned int dest_key_size);
247 grn_obj *table,
248 const void *src_key,
249 unsigned int src_key_size,
250 const void *dest_key,
251 unsigned int dest_key_size);
272
273#define GRN_CURSOR_ASCENDING (0x00 << 0)
274#define GRN_CURSOR_DESCENDING (0x01 << 0)
275#define GRN_CURSOR_GE (0x00 << 1)
276#define GRN_CURSOR_GT (0x01 << 1)
277#define GRN_CURSOR_LE (0x00 << 2)
278#define GRN_CURSOR_LT (0x01 << 2)
279#define GRN_CURSOR_BY_KEY (0x00 << 3)
280#define GRN_CURSOR_BY_ID (0x01 << 3)
281#define GRN_CURSOR_PREFIX (0x01 << 4)
282#define GRN_CURSOR_SIZE_BY_BIT (0x01 << 5)
283#define GRN_CURSOR_RK (0x01 << 6)
284
362 grn_obj *table,
363 const void *min,
364 unsigned int min_size,
365 const void *max,
366 unsigned int max_size,
367 int offset,
368 int limit,
369 int flags);
380
392
403GRN_API int
405
416GRN_API int
418GRN_API uint32_t
421 void **key,
422 uint32_t *key_size,
423 void **value);
442 const void *value,
443 int flags);
456GRN_API size_t
468
495 grn_obj *index,
496 grn_id rid_min,
497 grn_id rid_max,
498 int flags);
503 grn_obj *index_cursor,
504 grn_id term_id);
507 grn_obj *index_cursor,
508 uint32_t section_id);
509GRN_API uint32_t
512grn_index_cursor_set_scale(grn_ctx *ctx, grn_obj *index_cursor, float scale);
515 grn_obj *index_cursor,
516 float *scales,
517 size_t n_scales);
520 grn_obj *index_cursor,
521 uint32_t position);
524GRN_API uint32_t
539grn_index_cursor_next(grn_ctx *ctx, grn_obj *index_cursor, grn_id *term_id);
540
542 grn_table_cursor *cursor,
543 grn_id id,
544 void *user_data);
547 grn_table_cursor *cursor,
549 void *user_data);
550
551#define GRN_TABLE_EACH(ctx, \
552 table, \
553 head, \
554 tail, \
555 id, \
556 key, \
557 key_size, \
558 value, \
559 block) \
560 do { \
561 (ctx)->errlvl = GRN_LOG_NOTICE; \
562 (ctx)->rc = GRN_SUCCESS; \
563 if ((ctx)->seqno & 1) { \
564 (ctx)->subno++; \
565 } else { \
566 (ctx)->seqno++; \
567 } \
568 if ((table) && grn_table_size(ctx, (table)) > 0) { \
569 switch ((table)->header.type) { \
570 case GRN_TABLE_PAT_KEY: \
571 GRN_PAT_EACH((ctx), \
572 (grn_pat *)(table), \
573 (id), \
574 (key), \
575 (key_size), \
576 (value), \
577 block); \
578 break; \
579 case GRN_TABLE_DAT_KEY: \
580 GRN_DAT_EACH((ctx), \
581 (grn_dat *)(table), \
582 (id), \
583 (key), \
584 (key_size), \
585 block); \
586 break; \
587 case GRN_TABLE_HASH_KEY: \
588 GRN_HASH_EACH((ctx), \
589 (grn_hash *)(table), \
590 (id), \
591 (key), \
592 (key_size), \
593 (value), \
594 block); \
595 break; \
596 case GRN_TABLE_NO_KEY: \
597 GRN_ARRAY_EACH((ctx), \
598 (grn_array *)(table), \
599 (head), \
600 (tail), \
601 (id), \
602 (value), \
603 block); \
604 break; \
605 } \
606 } \
607 if ((ctx)->subno) { \
608 (ctx)->subno--; \
609 } else { \
610 (ctx)->seqno++; \
611 } \
612 } while (0)
613
614#define GRN_TABLE_EACH_BEGIN(ctx, table, cursor, id) \
615 do { \
616 if ((table) && grn_table_size(ctx, (table)) > 0) { \
617 grn_table_cursor *cursor; \
618 cursor = grn_table_cursor_open((ctx), \
619 (table), \
620 NULL, \
621 0, \
622 NULL, \
623 0, \
624 0, \
625 -1, \
626 GRN_CURSOR_ASCENDING); \
627 if (cursor) { \
628 grn_id id; \
629 while ((id = grn_table_cursor_next((ctx), cursor))) {
630
631#define GRN_TABLE_EACH_BEGIN_FLAGS(ctx, table, cursor, id, flags) \
632 do { \
633 if ((table) && grn_table_size(ctx, (table)) > 0) { \
634 grn_table_cursor *cursor; \
635 cursor = grn_table_cursor_open((ctx), \
636 (table), \
637 NULL, \
638 0, \
639 NULL, \
640 0, \
641 0, \
642 -1, \
643 (flags)); \
644 if (cursor) { \
645 grn_id id; \
646 while ((id = grn_table_cursor_next((ctx), cursor))) {
647
648#define GRN_TABLE_EACH_BEGIN_MIN(ctx, table, cursor, id, min, min_size, flags) \
649 do { \
650 if ((table) && grn_table_size(ctx, (table)) > 0) { \
651 grn_table_cursor *cursor; \
652 cursor = grn_table_cursor_open((ctx), \
653 (table), \
654 (min), \
655 (min_size), \
656 NULL, \
657 0, \
658 0, \
659 -1, \
660 (flags)); \
661 if (cursor) { \
662 grn_id id; \
663 while ((id = grn_table_cursor_next((ctx), cursor))) {
664
665#define GRN_TABLE_EACH_END(ctx, cursor) \
666 } \
667 grn_table_cursor_close((ctx), cursor); \
668 } \
669 } \
670 } \
671 while (0)
672
674typedef unsigned char grn_table_sort_flags;
675
679#define GRN_TABLE_SORT_ASC (0x00 << 0)
683#define GRN_TABLE_SORT_DESC (0x01 << 0)
684
690
711GRN_API int
713 grn_obj *table,
714 int offset,
715 int limit,
716 grn_obj *result,
717 grn_table_sort_key *keys,
718 int n_keys);
719
721typedef uint32_t grn_table_group_flags;
722
723#define GRN_TABLE_GROUP_CALC_COUNT (0x01 << 3)
724#define GRN_TABLE_GROUP_CALC_MAX (0x01 << 4)
725#define GRN_TABLE_GROUP_CALC_MIN (0x01 << 5)
726#define GRN_TABLE_GROUP_CALC_SUM (0x01 << 6)
727/* Deprecated since 10.0.4. Use GRN_TABLE_GROUP_CALC_MEAN instead. */
728#define GRN_TABLE_GROUP_CALC_AVG GRN_TABLE_GROUP_CALC_MEAN
729#define GRN_TABLE_GROUP_CALC_MEAN (0x01 << 7)
730#define GRN_TABLE_GROUP_CALC_AGGREGATOR (0x01 << 8)
731#define GRN_TABLE_GROUP_LIMIT (0x01 << 9)
732#define GRN_TABLE_GROUP_KEY_VECTOR_EXPANSION_POWER_SET (0x01 << 10)
733
734typedef struct _grn_table_group_aggregator grn_table_group_aggregator;
735
740 grn_table_group_aggregator *aggregator);
743 grn_ctx *ctx,
744 grn_table_group_aggregator *aggregator,
745 const char *name,
746 int32_t name_len);
747GRN_API const char *
749 grn_ctx *ctx, grn_table_group_aggregator *aggregator, uint32_t *len);
752 grn_ctx *ctx, grn_table_group_aggregator *aggregator, grn_obj *type);
755 grn_ctx *ctx, grn_table_group_aggregator *aggregator);
758 grn_ctx *ctx, grn_table_group_aggregator *aggregator, grn_column_flags flags);
761 grn_ctx *ctx, grn_table_group_aggregator *aggregator);
764 grn_ctx *ctx,
765 grn_table_group_aggregator *aggregator,
766 const char *expression,
767 int32_t expression_len);
768GRN_API const char *
770 grn_ctx *ctx,
771 grn_table_group_aggregator *aggregator,
772 uint32_t *expression_len);
773
786
803 grn_obj *table,
804 grn_table_sort_key *keys,
805 int n_keys,
806 grn_table_group_result *results,
807 int n_results);
810 grn_obj *table,
811 const char *raw_sort_keys,
812 int32_t raw_sort_keys_size,
813 uint32_t *n_keys);
836 grn_obj *table1,
837 grn_obj *table2,
838 grn_obj *res,
839 grn_operator op);
854 grn_ctx *ctx, grn_obj *table1, grn_obj *table2, grn_obj *res1, grn_obj *res2);
866GRN_API int
868 grn_obj *table,
869 const char *name,
870 unsigned int name_size,
871 grn_obj *res);
872
881GRN_API unsigned int
883
898 grn_obj *table,
899 const char *name,
900 unsigned int name_size);
901
904 grn_obj *table,
905 grn_obj *expr,
906 grn_obj *result_set,
907 grn_operator op);
908
911 const char *str,
912 unsigned int str_size,
913 grn_obj *table,
914 uint32_t *nkeys);
917 grn_obj *table,
918 const char *raw_sort_keys,
919 int32_t raw_sort_keys_size,
920 uint32_t *n_keys);
923 grn_table_sort_key *keys,
924 uint32_t nkeys);
925
926GRN_API bool
928
929GRN_API unsigned int
931
934 const char *name,
935 unsigned int name_size,
936 const char *path,
937 grn_obj *group_key,
938 grn_obj *value_type,
939 uint32_t max_n_subrecs);
940
941GRN_API unsigned int
943 grn_obj *table,
944 grn_id id,
945 grn_id *subrecbuf,
946 int *scorebuf,
947 int buf_size);
948
951 grn_obj *table,
952 const char *str,
953 unsigned int str_len,
954 grn_obj *buf,
955 bool addp);
956
959 grn_obj *table,
960 grn_obj *output_column,
961 grn_obj *expr);
962
965
968
971 grn_obj *table,
972 grn_obj **duplicated_keys);
973GRN_API bool
975
976GRN_API bool
978
991GRN_API bool
993
1023
1024typedef struct _grn_table_selector grn_table_selector;
1025
1028 grn_obj *table,
1029 grn_obj *expr,
1030 grn_operator op);
1037 grn_table_selector *table_selector,
1038 grn_id min_id);
1039GRN_API bool
1041 grn_table_selector *table_selector);
1044 grn_table_selector *table_selector,
1045 bool use);
1046GRN_API float
1048 grn_table_selector *table_selector);
1051 grn_table_selector *table_selector,
1052 float factor);
1053GRN_API double
1055 grn_ctx *ctx, grn_table_selector *table_selector);
1058 grn_table_selector *table_selector,
1059 double ratio);
1060GRN_API int64_t
1062 grn_ctx *ctx, grn_table_selector *table_selector);
1065 grn_ctx *ctx, grn_table_selector *table_selector, int64_t n);
1066GRN_API bool
1068 grn_ctx *ctx, grn_table_selector *table_selector);
1071 grn_ctx *ctx, grn_table_selector *table_selector, bool use);
1072GRN_API uint32_t
1074 grn_table_selector *table_selector);
1077 grn_table_selector *table_selector,
1078 uint32_t distance);
1079GRN_API uint32_t
1081 grn_table_selector *table_selector);
1084 grn_table_selector *table_selector,
1085 uint32_t expansions);
1086GRN_API uint32_t
1088 grn_table_selector *table_selector);
1091 grn_table_selector *table_selector,
1092 uint32_t length);
1093GRN_API float
1095 grn_ctx *ctx, grn_table_selector *table_selector);
1098 grn_ctx *ctx, grn_table_selector *table_selector, float ratio);
1099GRN_API bool
1101 grn_ctx *ctx, grn_table_selector *table_selector);
1104 grn_ctx *ctx, grn_table_selector *table_selector, bool with);
1105GRN_API bool
1107 grn_table_selector *table_selector);
1110 grn_table_selector *table_selector,
1111 bool tokenize);
1114 grn_table_selector *table_selector,
1115 grn_obj *result_set);
1116
1117#ifdef __cplusplus
1118}
1119#endif
grn_rc
Definition groonga.h:61
uint32_t grn_id
Definition groonga.h:44
#define GRN_API
Definition groonga.h:39
grn_operator
Definition groonga.h:1149
uint32_t grn_table_flags
Definition groonga.h:680
uint32_t grn_column_flags
Definition groonga.h:681
Definition groonga.h:351
Definition groonga.h:919
Definition table.h:774
uint32_t max_n_subrecs
Definition table.h:781
uint32_t n_aggregators
Definition table.h:784
grn_operator op
Definition table.h:780
uint8_t key_begin
Definition table.h:776
uint8_t key_end
Definition table.h:777
int limit
Definition table.h:778
grn_table_group_aggregator ** aggregators
Definition table.h:783
grn_obj * calc_target
Definition table.h:782
grn_table_group_flags flags
Definition table.h:779
grn_obj * table
Definition table.h:775
Definition table.h:685
grn_obj * key
Definition table.h:686
grn_table_sort_flags flags
Definition table.h:687
int offset
Definition table.h:688
Definition posting.h:26
GRN_API grn_obj * grn_table_create_similar(grn_ctx *ctx, const char *name, uint32_t name_size, const char *path, grn_obj *base_table)
GRN_API grn_id grn_table_at(grn_ctx *ctx, grn_obj *table, grn_id id)
Search the table for a record of ID and return the specified ID if it exists, or GRN_ID_NIL if it doe...
GRN_API grn_rc grn_table_group_aggregator_set_output_column_name(grn_ctx *ctx, grn_table_group_aggregator *aggregator, const char *name, int32_t name_len)
GRN_API grn_obj * grn_table_tokenize(grn_ctx *ctx, grn_obj *table, const char *str, unsigned int str_len, grn_obj *buf, bool addp)
GRN_API grn_rc grn_index_cursor_set_term_id(grn_ctx *ctx, grn_obj *index_cursor, grn_id term_id)
GRN_API grn_rc grn_table_cursor_close(grn_ctx *ctx, grn_table_cursor *tc)
Free the cursor created by grn_table_cursor_open()
GRN_API grn_table_group_aggregator * grn_table_group_aggregator_open(grn_ctx *ctx)
GRN_API bool grn_table_selector_get_ensure_using_select_result(grn_ctx *ctx, grn_table_selector *table_selector)
GRN_API grn_rc grn_index_cursor_set_start_position(grn_ctx *ctx, grn_obj *index_cursor, uint32_t position)
GRN_API grn_rc grn_index_cursor_set_scales(grn_ctx *ctx, grn_obj *index_cursor, float *scales, size_t n_scales)
GRN_API grn_obj * grn_table_create_for_group(grn_ctx *ctx, const char *name, unsigned int name_size, const char *path, grn_obj *group_key, grn_obj *value_type, uint32_t max_n_subrecs)
GRN_API int grn_table_get_key(grn_ctx *ctx, grn_obj *table, grn_id id, void *keybuf, int buf_size)
Get the key assigned to the ID. If the size of the key found is larger than buf_size,...
GRN_API int grn_table_sort(grn_ctx *ctx, grn_obj *table, int offset, int limit, grn_obj *result, grn_table_sort_key *keys, int n_keys)
Sort the records in table and store the results in result
GRN_API grn_id grn_table_find_reference_object(grn_ctx *ctx, grn_obj *table)
GRN_API grn_rc grn_table_update_by_id(grn_ctx *ctx, grn_obj *table, grn_id id, const void *dest_key, unsigned int dest_key_size)
Update the key of the record matching ID in the table. This operation supports only GRN_TABLE_DAT_KEY...
GRN_API grn_rc grn_table_cursor_foreach(grn_ctx *ctx, grn_table_cursor *cursor, grn_table_cursor_foreach_func func, void *user_data)
GRN_API grn_id grn_table_cursor_next(grn_ctx *ctx, grn_table_cursor *tc)
Move the cursur forward to the next and return its record ID. Return GRN_ID_NIL when the end is reach...
GRN_API bool grn_table_selector_get_fuzzy_with_transposition(grn_ctx *ctx, grn_table_selector *table_selector)
GRN_API grn_rc grn_table_copy(grn_ctx *ctx, grn_obj *from, grn_obj *to)
GRN_API grn_rc grn_table_cursor_set_value(grn_ctx *ctx, grn_table_cursor *tc, const void *value, int flags)
Set value to the current record according to flags
GRN_API const char * grn_table_group_aggregator_get_expression(grn_ctx *ctx, grn_table_group_aggregator *aggregator, uint32_t *expression_len)
GRN_API grn_column_flags grn_table_group_aggregator_get_output_column_flags(grn_ctx *ctx, grn_table_group_aggregator *aggregator)
GRN_API grn_rc grn_table_selector_set_fuzzy_max_distance(grn_ctx *ctx, grn_table_selector *table_selector, uint32_t distance)
GRN_API grn_table_cursor * grn_table_cursor_open(grn_ctx *ctx, grn_obj *table, const void *min, unsigned int min_size, const void *max, unsigned int max_size, int offset, int limit, int flags)
Creates and returns a cursor to retrieve the records registered in the table in order.
GRN_API grn_rc grn_table_selector_set_fuzzy_prefix_length(grn_ctx *ctx, grn_table_selector *table_selector, uint32_t length)
GRN_API int grn_table_columns(grn_ctx *ctx, grn_obj *table, const char *name, unsigned int name_size, grn_obj *res)
Store the column IDs of the table starting with name in res.
GRN_API grn_rc grn_table_selector_set_use_sequential_scan(grn_ctx *ctx, grn_table_selector *table_selector, bool use)
GRN_API grn_obj * grn_index_cursor_open(grn_ctx *ctx, grn_table_cursor *tc, grn_obj *index, grn_id rid_min, grn_id rid_max, int flags)
Create a cursor that returns postings in GRN_OBJ_COLUMN_INDEX.
GRN_API grn_obj * grn_table_group_aggregator_get_output_column_type(grn_ctx *ctx, grn_table_group_aggregator *aggregator)
GRN_API grn_obj * grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr, grn_obj *result_set, grn_operator op)
struct _grn_table_group_aggregator grn_table_group_aggregator
Definition table.h:734
GRN_API grn_rc grn_table_selector_set_fuzzy_max_distance_ratio(grn_ctx *ctx, grn_table_selector *table_selector, float ratio)
GRN_API int grn_table_cursor_get_value(grn_ctx *ctx, grn_table_cursor *tc, void **value)
Sets the value of the current record in cursor to value parameter and returns its length.
GRN_API bool grn_table_selector_get_fuzzy_tokenize(grn_ctx *ctx, grn_table_selector *table_selector)
unsigned char grn_table_sort_flags
Definition table.h:674
GRN_API grn_rc grn_table_selector_set_fuzzy_max_expansions(grn_ctx *ctx, grn_table_selector *table_selector, uint32_t expansions)
GRN_API grn_rc grn_table_group_aggregator_set_expression(grn_ctx *ctx, grn_table_group_aggregator *aggregator, const char *expression, int32_t expression_len)
GRN_API grn_rc grn_table_apply_expr(grn_ctx *ctx, grn_obj *table, grn_obj *output_column, grn_obj *expr)
GRN_API grn_posting * grn_index_cursor_next(grn_ctx *ctx, grn_obj *index_cursor, grn_id *term_id)
Retrieve the current posting information and move the cursor to the the next.
GRN_API uint32_t grn_table_selector_get_fuzzy_max_distance(grn_ctx *ctx, grn_table_selector *table_selector)
GRN_API grn_rc grn_table_selector_set_fuzzy_tokenize(grn_ctx *ctx, grn_table_selector *table_selector, bool tokenize)
GRN_API double grn_table_selector_get_enough_filtered_ratio(grn_ctx *ctx, grn_table_selector *table_selector)
GRN_API grn_obj * grn_table_selector_select(grn_ctx *ctx, grn_table_selector *table_selector, grn_obj *result_set)
GRN_API grn_rc grn_table_selector_set_fuzzy_with_transposition(grn_ctx *ctx, grn_table_selector *table_selector, bool with)
GRN_API grn_table_selector * grn_table_selector_open(grn_ctx *ctx, grn_obj *table, grn_obj *expr, grn_operator op)
GRN_API grn_obj * grn_index_cursor_get_index_column(grn_ctx *ctx, grn_obj *index_cursor)
GRN_API uint32_t grn_table_selector_get_fuzzy_prefix_length(grn_ctx *ctx, grn_table_selector *table_selector)
GRN_API grn_id grn_table_selector_get_min_id(grn_ctx *ctx, grn_table_selector *table_selector)
GRN_API grn_rc grn_table_cursor_delete(grn_ctx *ctx, grn_table_cursor *tc)
Delete the current record for cursor.
GRN_API grn_rc grn_table_difference(grn_ctx *ctx, grn_obj *table1, grn_obj *table2, grn_obj *res1, grn_obj *res2)
Delete duplicated records in table1 and table2.
GRN_API grn_table_sort_key * grn_table_group_keys_parse(grn_ctx *ctx, grn_obj *table, const char *raw_sort_keys, int32_t raw_sort_keys_size, uint32_t *n_keys)
grn_rc(* grn_table_cursor_foreach_func)(grn_ctx *ctx, grn_table_cursor *cursor, grn_id id, void *user_data)
Definition table.h:541
GRN_API grn_id grn_table_lcp_search(grn_ctx *ctx, grn_obj *table, const void *key, unsigned int key_size)
Execute longest common prefix (LCP) search and return ID found.
GRN_API grn_rc grn_table_truncate(grn_ctx *ctx, grn_obj *table)
Delete all records in table.
GRN_API grn_rc grn_table_selector_set_enough_filtered_ratio(grn_ctx *ctx, grn_table_selector *table_selector, double ratio)
GRN_API grn_rc grn_table_get_duplicated_keys(grn_ctx *ctx, grn_obj *table, grn_obj **duplicated_keys)
GRN_API grn_table_sort_key * grn_table_sort_keys_parse(grn_ctx *ctx, grn_obj *table, const char *raw_sort_keys, int32_t raw_sort_keys_size, uint32_t *n_keys)
GRN_API grn_rc grn_index_cursor_reset_start_position(grn_ctx *ctx, grn_obj *index_cursor)
GRN_API int grn_table_cursor_get_key(grn_ctx *ctx, grn_table_cursor *tc, void **key)
Sets the key of the current record in cursor to key parameter and returns its length.
GRN_API grn_rc grn_table_update(grn_ctx *ctx, grn_obj *table, const void *src_key, unsigned int src_key_size, const void *dest_key, unsigned int dest_key_size)
Change the key of the record matching the src_key of the table. Specify the new key and its byte leng...
GRN_API int64_t grn_table_selector_get_max_n_enough_filtered_records(grn_ctx *ctx, grn_table_selector *table_selector)
GRN_API grn_rc grn_table_setoperation(grn_ctx *ctx, grn_obj *table1, grn_obj *table2, grn_obj *res, grn_operator op)
Execute the set operation of table1 and table2 according to the specification of op and store the res...
GRN_API grn_obj * grn_table_cursor_table(grn_ctx *ctx, grn_table_cursor *tc)
Return the table of cursor.
GRN_API grn_rc grn_table_rename(grn_ctx *ctx, grn_obj *table, const char *name, unsigned int name_size)
Rename table to name. All columns of the table are renamed at the same time. The table must be a pers...
GRN_API grn_rc grn_table_selector_set_max_n_enough_filtered_records(grn_ctx *ctx, grn_table_selector *table_selector, int64_t n)
GRN_API grn_table_sort_key * grn_table_sort_key_from_str(grn_ctx *ctx, const char *str, unsigned int str_size, grn_obj *table, uint32_t *nkeys)
GRN_API bool grn_table_selector_get_use_sequential_scan(grn_ctx *ctx, grn_table_selector *table_selector)
GRN_API float grn_table_selector_get_fuzzy_max_distance_ratio(grn_ctx *ctx, grn_table_selector *table_selector)
GRN_API grn_rc grn_table_delete_by_id(grn_ctx *ctx, grn_obj *table, grn_id id)
Delete the record matching the ID in the table.
GRN_API grn_rc grn_table_sort_key_close(grn_ctx *ctx, grn_table_sort_key *keys, uint32_t nkeys)
GRN_API size_t grn_table_cursor_get_max_n_records(grn_ctx *ctx, grn_table_cursor *cursor)
GRN_API grn_rc grn_table_delete(grn_ctx *ctx, grn_obj *table, const void *key, unsigned int key_size)
Delete the record matching the key in the table.
GRN_API grn_rc grn_table_selector_close(grn_ctx *ctx, grn_table_selector *table_selector)
GRN_API float grn_table_selector_get_weight_factor(grn_ctx *ctx, grn_table_selector *table_selector)
GRN_API grn_rc grn_index_cursor_set_scale(grn_ctx *ctx, grn_obj *index_cursor, float scale)
uint32_t grn_table_group_flags
Definition table.h:721
GRN_API unsigned int grn_table_max_n_subrecs(grn_ctx *ctx, grn_obj *table)
GRN_API grn_rc grn_table_group_aggregator_set_output_column_flags(grn_ctx *ctx, grn_table_group_aggregator *aggregator, grn_column_flags flags)
GRN_API grn_rc grn_index_cursor_set_section_id(grn_ctx *ctx, grn_obj *index_cursor, uint32_t section_id)
GRN_API grn_rc grn_table_group(grn_ctx *ctx, grn_obj *table, grn_table_sort_key *keys, int n_keys, grn_table_group_result *results, int n_results)
Group the records in the table.
GRN_API bool grn_table_have_duplicated_keys(grn_ctx *ctx, grn_obj *table)
GRN_API uint32_t grn_table_selector_get_fuzzy_max_expansions(grn_ctx *ctx, grn_table_selector *table_selector)
GRN_API grn_rc grn_table_group_aggregator_set_output_column_type(grn_ctx *ctx, grn_table_group_aggregator *aggregator, grn_obj *type)
GRN_API uint32_t grn_table_cursor_get_key_value(grn_ctx *ctx, grn_table_cursor *tc, void **key, uint32_t *key_size, void **value)
GRN_API bool grn_table_have_extractor(grn_ctx *ctx, grn_obj *table)
Return whether the given table have one or more extractors or not.
GRN_API grn_id grn_table_add(grn_ctx *ctx, grn_obj *table, const void *key, unsigned int key_size, int *added)
Add a new record with key to the table and return its ID. If key already exists in the table,...
GRN_API grn_obj * grn_table_extract(grn_ctx *ctx, grn_obj *table, grn_obj *value)
Extract data from the given value by extractors associated with the given table.
GRN_API grn_id grn_table_get(grn_ctx *ctx, grn_obj *table, const void *key, unsigned int key_size)
It finds a record that has key parameter and returns ID of the found record. If table parameter is a ...
GRN_API uint32_t grn_index_cursor_get_section_id(grn_ctx *ctx, grn_obj *index_cursor)
GRN_API unsigned int grn_table_size(grn_ctx *ctx, grn_obj *table)
Return the number of records registered in the table.
GRN_API unsigned int grn_table_get_subrecs(grn_ctx *ctx, grn_obj *table, grn_id id, grn_id *subrecbuf, int *scorebuf, int buf_size)
GRN_API bool grn_table_have_tokenizer(grn_ctx *ctx, grn_obj *table)
GRN_API grn_rc grn_table_group_aggregator_close(grn_ctx *ctx, grn_table_group_aggregator *aggregator)
GRN_API const char * grn_table_group_aggregator_get_output_column_name(grn_ctx *ctx, grn_table_group_aggregator *aggregator, uint32_t *len)
GRN_API uint32_t grn_index_cursor_get_start_position(grn_ctx *ctx, grn_obj *index_cursor)
GRN_API grn_obj * grn_table_create(grn_ctx *ctx, const char *name, unsigned int name_size, const char *path, grn_table_flags flags, grn_obj *key_type, grn_obj *value_type)
Define a new table in the DB used by ctx.
GRN_API grn_rc grn_table_selector_set_weight_factor(grn_ctx *ctx, grn_table_selector *table_selector, float factor)
GRN_API grn_rc grn_table_selector_set_min_id(grn_ctx *ctx, grn_table_selector *table_selector, grn_id min_id)
GRN_API bool grn_table_is_grouped(grn_ctx *ctx, grn_obj *table)
struct _grn_table_selector grn_table_selector
Definition table.h:1024
GRN_API grn_rc grn_table_selector_set_ensure_using_select_result(grn_ctx *ctx, grn_table_selector *table_selector, bool use)