Gnosis
Pattern Query
Intersect exact string indexes, or scan all Strand entries when every field is None.
QueryPattern contains three Option<String> fields. Populated fields match exact strings and their index sets are intersected. With all fields None, query scans the Strand and decodes triples. Indexed result order comes from a hash set and is not guaranteed; sort in the caller when order matters. After a fresh open, historical indexed queries can return empty because no automatic replay populates the indexes. The example adds all queried triples to this same instance.
This example is checked against source signatures; it was not compiled or run during this documentation pass.
pub struct QueryPattern {
pub subject: Option<String>,
pub predicate: Option<String>,
pub object: Option<String>,
}