1 /*
2   Copyright(C) 2009-2017  Brazil
3   Copyright(C) 2019-2021  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 module groonga_d.ii;
20 
21 
22 private static import groonga_d.groonga;
23 private static import groonga_d.hash;
24 private static import groonga_d.posting;
25 
26 extern(C):
27 nothrow @nogc:
28 
29 /* buffered index builder */
30 
31 extern struct _grn_ii;
32 extern struct _grn_ii_buffer;
33 
34 alias grn_ii = _grn_ii;
35 alias grn_ii_buffer = _grn_ii_buffer;
36 
37 //GRN_API
38 groonga_d.groonga.grn_column_flags grn_ii_get_flags(groonga_d.groonga.grn_ctx* ctx, grn_ii* ii);
39 
40 //GRN_API
41 uint grn_ii_get_n_elements(groonga_d.groonga.grn_ctx* ctx, grn_ii* ii);
42 
43 //GRN_API
44 void grn_ii_cursor_set_min_enable_set(groonga_d.groonga.grn_bool enable);
45 
46 //GRN_API
47 groonga_d.groonga.grn_bool grn_ii_cursor_set_min_enable_get();
48 
49 //GRN_API
50 uint grn_ii_estimate_size(groonga_d.groonga.grn_ctx* ctx, grn_ii* ii, groonga_d.groonga.grn_id tid);
51 
52 //GRN_API
53 uint grn_ii_estimate_size_for_query(groonga_d.groonga.grn_ctx* ctx, grn_ii* ii, const (char)* query, uint query_len, groonga_d.groonga.grn_search_optarg* optarg);
54 
55 //GRN_API
56 uint grn_ii_estimate_size_for_lexicon_cursor(groonga_d.groonga.grn_ctx* ctx, grn_ii* ii, groonga_d.groonga.grn_table_cursor* lexicon_cursor);
57 
58 //GRN_API
59 grn_ii_buffer* grn_ii_buffer_open(groonga_d.groonga.grn_ctx* ctx, grn_ii* ii, ulong update_buffer_size);
60 
61 //GRN_API
62 groonga_d.groonga.grn_rc grn_ii_buffer_append(groonga_d.groonga.grn_ctx* ctx, grn_ii_buffer* ii_buffer, groonga_d.groonga.grn_id rid, uint section, groonga_d.groonga.grn_obj* value);
63 
64 //GRN_API
65 groonga_d.groonga.grn_rc grn_ii_buffer_commit(groonga_d.groonga.grn_ctx* ctx, grn_ii_buffer* ii_buffer);
66 
67 //GRN_API
68 groonga_d.groonga.grn_rc grn_ii_buffer_close(groonga_d.groonga.grn_ctx* ctx, grn_ii_buffer* ii_buffer);
69 
70 //GRN_API
71 groonga_d.groonga.grn_rc grn_ii_posting_add(groonga_d.groonga.grn_ctx* ctx, groonga_d.posting.grn_posting* pos, groonga_d.hash.grn_hash* s, groonga_d.groonga.grn_operator op);
72 /* Deprecated since 10.0.3. Use grn_rset_add_records() instead. */
73 //GRN_API
74 groonga_d.groonga.grn_rc grn_ii_posting_add_float(groonga_d.groonga.grn_ctx* ctx, groonga_d.posting.grn_posting* pos, groonga_d.hash.grn_hash* s, groonga_d.groonga.grn_operator op);
75 
76 //GRN_API
77 void grn_ii_resolve_sel_and(groonga_d.groonga.grn_ctx* ctx, groonga_d.hash.grn_hash* s, groonga_d.groonga.grn_operator op);
78 
79 /* Experimental */
80 extern struct _grn_ii_cursor;
81 alias grn_ii_cursor = _grn_ii_cursor;
82 
83 //GRN_API
84 grn_ii_cursor* grn_ii_cursor_open(groonga_d.groonga.grn_ctx* ctx, grn_ii* ii, groonga_d.groonga.grn_id tid, groonga_d.groonga.grn_id min, groonga_d.groonga.grn_id max, int nelements, int flags);
85 
86 //GRN_API
87 grn_ii* grn_ii_cursor_get_ii(groonga_d.groonga.grn_ctx* ctx, grn_ii_cursor* cursor);
88 
89 //GRN_API
90 groonga_d.groonga.grn_rc grn_ii_cursor_set_scales(groonga_d.groonga.grn_ctx* ctx, .grn_ii_cursor* cursor, float* scales, size_t n_scales);
91 
92 //GRN_API
93 groonga_d.groonga.grn_rc grn_ii_cursor_set_scale(groonga_d.groonga.grn_ctx* ctx, .grn_ii_cursor* cursor, float scale);
94 
95 //GRN_API
96 groonga_d.posting.grn_posting* grn_ii_cursor_next(groonga_d.groonga.grn_ctx* ctx, grn_ii_cursor* c);
97 
98 //GRN_API
99 groonga_d.posting.grn_posting* grn_ii_cursor_next_pos(groonga_d.groonga.grn_ctx* ctx, grn_ii_cursor* c);
100 
101 //GRN_API
102 groonga_d.groonga.grn_rc grn_ii_cursor_close(groonga_d.groonga.grn_ctx* ctx, grn_ii_cursor* c);