Language model search engine built on a vector database and an anything key/value store.
Language model search engine built on a vector database and an anything key/value store.
This is a reboot of the old Resin search engine/machine learning project.
Resin is a vector space search engine, a vector database and an anything key/value store. It powers efficient string processing, vector operations, and custom storage primitives designed for speed and simplicity. It can produce large language models out of strings and large anything models out of byte arrays.
TryPut(TKey key, ReadOnlySpan value)
false when the key already exists; otherwise writes to the current page.PutOrAppend(TKey key, ReadOnlySpan value)
LinkedAddressNode) written to the value stream.Get(TKey key)
key. If the key’s address entry points to a linked-list head, returns the concatenated bytes of all linked values.ReadOnlySpan.Empty when the key does not exist.GetMany(TKey key, out int count)
ReadOnlySpan of all values linked for key and outputs the number of items via count.count = 1. If the key does not exist, returns empty and count = 0.When working with TKey, please adhere to the following restrictions to ensure proper functionality:
TKey must be a value type (struct) and implement both IEquatable and IComparable.BinarySearch/sorting, so CompareTo must define a strict total order consistent with Equals.long keys. For primitive numeric keys:double and float are stored via their IEEE bit representations.int and long are stored directly.TKey types are hashed via GetHashCode() to a long for page-level operations.double, float, int, long) for deterministic ordering and lookup. If using a custom struct, ensure:Equals and CompareTo are consistent and deterministic.GetHashCode() is stable and evenly distributed; collisions affect page-level operations since non-primitive keys are hashed to long.BinarySearch over sorted keys.TKey at most once in its column-wide snapshot (duplicate keys are prevented by both TryPut and PutOrAppend). This makes columns effectively sets of keys, enabling set operations such as union, intersection, and joins across columns. Linked values (via PutOrAppend) attach additional data to the existing key without introducing duplicates.TKey representations per page/column. Keys are written in fixed-size slots (sizeof(long) per entry for page-level storage) and serialized in page batches. The column-wide snapshot is built by reading and sorting this stream.Address structs aligned with .key entries. Each Address contains Offset and Length:.val (Offset = start of value, Length = byte length).LinkedAddressNode head in .val (Length equals node size). The node chain yields multiple values for a single key.LinkedAddressNode headers used for linking. Values are appended at the end of the stream; LinkedAddressNodes are also written into .val to form singly linked lists via absolute offsets..val stream is treated as append-only:LinkedAddressNode headers are appended and previous node’s NextOffset is patched by writing a new node and updating pointers via .adr alignment.Resin.KeyValue for fast on disk structures and efficient read/write key/value sessions.Resin.TextAnalysis for StringAnalyzer, VectorOperations, and similarity tooling.Resin.WikipediaCommandLine for commandline tools to build/validate lexicons. See detailed CLI usage and setup in Resin.WikipediaCommandLine/README.md.Contributions are welcome! Please open an issue or pull request with clear motivation, tests when applicable, and concise changes.
This project is licensed under the MIT License.
No open issues yet, or sync has not completed.