mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-03-19 02:07:14 +01:00
Add more docs to the local autocomplete binary layout
This commit is contained in:
parent
25973857c5
commit
6cd01b5164
1 changed files with 23 additions and 8 deletions
|
@ -6,31 +6,46 @@ defmodule Philomena.Autocomplete.Generator do
|
||||||
The file follows the following binary format:
|
The file follows the following binary format:
|
||||||
|
|
||||||
struct tag {
|
struct tag {
|
||||||
uint8_t key_length;
|
// Full name of the tag in UTF8.
|
||||||
uint8_t key[];
|
uint8_t name_length;
|
||||||
uint8_t association_length;
|
uint8_t name[];
|
||||||
|
|
||||||
|
// List of IDs of other tags that appear on the same images in >50% of cases
|
||||||
|
uint8_t associations_length;
|
||||||
uint32_t associations[];
|
uint32_t associations[];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tag_reference {
|
struct tag_reference {
|
||||||
|
// Index of the tag in the `tags` array
|
||||||
uint32_t tag_location;
|
uint32_t tag_location;
|
||||||
union {
|
|
||||||
int32_t raw;
|
// If >=0 then this tag is canonical and the `meta` is the number of images with this tag
|
||||||
uint32_t num_uses; ///< when positive
|
//
|
||||||
uint32_t alias_index; ///< when negative, -alias_index - 1
|
// If <0 then this is the index of the canonical tag aliased by this one
|
||||||
};
|
// in the `primary_references` array
|
||||||
|
int32_t meta;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct secondary_reference {
|
struct secondary_reference {
|
||||||
|
// Index of the tag in the `tags` array
|
||||||
uint32_t primary_location;
|
uint32_t primary_location;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct autocomplete_file {
|
struct autocomplete_file {
|
||||||
struct tag tags[];
|
struct tag tags[];
|
||||||
|
|
||||||
|
// List of canonical/alias tags references with their respective metadata
|
||||||
struct tag_reference primary_references[];
|
struct tag_reference primary_references[];
|
||||||
|
|
||||||
|
// List of references to tags sorted by tag name discarding the namespace
|
||||||
struct secondary_reference secondary_references[];
|
struct secondary_reference secondary_references[];
|
||||||
|
|
||||||
uint32_t format_version;
|
uint32_t format_version;
|
||||||
|
|
||||||
|
// Byte index of the `tag_reference` array start
|
||||||
uint32_t reference_start;
|
uint32_t reference_start;
|
||||||
|
|
||||||
|
// Length of the `tags` array.
|
||||||
uint32_t num_tags;
|
uint32_t num_tags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue