tagion_hibon_add_index_document

Add document to hibon by index

extern (C)
int
tagion_hibon_add_index_document
(,
const size_t index
,
const(uint8_t*) buf
,
const size_t buf_len
)

Parameters

instance HiBONT*

pointer to the hibon instance

index size_t

The index to put the Document at

buf const(uint8_t*)

pointer to the document buffer

buf_len size_t

length of the buffer

Return Value

Type: int

Examples

auto sub_hibon = new HiBON;
sub_hibon["sub_doc"] = "test";
const doc = Document(sub_hibon);

HiBONT h;
int rt = tagion_hibon_create(&h);
assert(rt == ErrorCode.none, "could not create hibon");
const key = 0;

rt = tagion_hibon_add_index_document(&h, key, &doc.data[0], doc.data.length);
HiBON string_hibon = cast(HiBON) h.hibon;
assert(string_hibon[key].get!Document == doc);