mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-03-19 18:27:13 +01:00
Apply Liam's corrections to the docs
This commit is contained in:
parent
6cd01b5164
commit
ec482db852
1 changed files with 16 additions and 8 deletions
|
@ -5,6 +5,9 @@ defmodule Philomena.Autocomplete.Generator do
|
||||||
See assets/js/utils/local-autocompleter.ts for how this should be used.
|
See assets/js/utils/local-autocompleter.ts for how this should be used.
|
||||||
The file follows the following binary format:
|
The file follows the following binary format:
|
||||||
|
|
||||||
|
// Note that all pointer types (`struct T*`) are all relative to the binary payload start.
|
||||||
|
|
||||||
|
// Variable-length struct.
|
||||||
struct tag {
|
struct tag {
|
||||||
// Full name of the tag in UTF8.
|
// Full name of the tag in UTF8.
|
||||||
uint8_t name_length;
|
uint8_t name_length;
|
||||||
|
@ -15,23 +18,28 @@ defmodule Philomena.Autocomplete.Generator do
|
||||||
uint32_t associations[];
|
uint32_t associations[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Fixed-length struct.
|
||||||
struct tag_reference {
|
struct tag_reference {
|
||||||
// Index of the tag in the `tags` array
|
// 32 bit pointer to a tag in the `tags` array
|
||||||
uint32_t tag_location;
|
struct tag* tag;
|
||||||
|
|
||||||
// If >=0 then this tag is canonical and the `meta` is the number of images with this tag
|
// If >=0 then this tag is canonical and the `meta` is the number of images with this tag
|
||||||
//
|
//
|
||||||
// If <0 then this is the index of the canonical tag aliased by this one
|
// If <0 then do the following calculation: `-meta - 1` and you'll get a 32 bit pointer
|
||||||
// in the `primary_references` array
|
// `struct tag_reference*` to the canonical tag aliased by this one in the `primary_references` array
|
||||||
int32_t meta;
|
int32_t meta;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Fixed-length struct.
|
||||||
struct secondary_reference {
|
struct secondary_reference {
|
||||||
// Index of the tag in the `tags` array
|
// Index of the `tag_reference` in the `primary_references` array
|
||||||
uint32_t primary_location;
|
uint32_t primary_reference_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Variable-length struct.
|
||||||
struct autocomplete_file {
|
struct autocomplete_file {
|
||||||
|
// Array of variable-length structs, so any references to the items in
|
||||||
|
// this array must be direct pointers instead of item indexes.
|
||||||
struct tag tags[];
|
struct tag tags[];
|
||||||
|
|
||||||
// List of canonical/alias tags references with their respective metadata
|
// List of canonical/alias tags references with their respective metadata
|
||||||
|
@ -42,8 +50,8 @@ defmodule Philomena.Autocomplete.Generator do
|
||||||
|
|
||||||
uint32_t format_version;
|
uint32_t format_version;
|
||||||
|
|
||||||
// Byte index of the `tag_reference` array start
|
// 32 bit pointer to the `primary_references` array start
|
||||||
uint32_t reference_start;
|
struct tag_reference* primary_references_start;
|
||||||
|
|
||||||
// Length of the `tags` array.
|
// Length of the `tags` array.
|
||||||
uint32_t num_tags;
|
uint32_t num_tags;
|
||||||
|
|
Loading…
Add table
Reference in a new issue