pub struct TextIndexSignal {
pub present: bool,
pub bytes: u64,
pub token_table_bytes: Option<u64>,
}Expand description
The file’s full-text-search affordance: does it carry a TEXT_INDEX section (kind 6), and what does that index cost?
A .rete built with --text-index answers FILTER(CONTAINS(…)) by word
lookup; one built without it answers the same query with the same rows by
full scan. The capability is invisible from the results, which is exactly how
the playground catalog came to advertise an index two published files never
carried (#189) — so a file has to be able to state it.
Measured at read time, never stored. The ground truth is the section
directory in the 1 KiB header that every card read already fetches, so a
stored copy would be a second source of truth for a fact the first source
answers for free — the same reasoning that keeps a curated language field
out of the card. Being a projection rather than a stamp also means every
already-published file reports it today, with no re-card, and that
rete repyramid --text-index (which rewrites the file’s sections) can never
leave it stale.
What it deliberately does not carry: a token count. The number of
distinct indexed words is the first varint of the decompressed token
table, so quoting it would mean fetching and inflating the whole table —
193 MB on the published causenet-full-typed.rete. token_table_bytes is
the same question answered for ≤10 bytes, and is the more useful answer
anyway: it is what a first search actually costs.
Fields§
§present: boolTrue iff the file has a kind-6 section. Always written, including as
false: “measured, and there is none” is the fact #189 was missing.
bytes: u64Byte length of the whole TEXT_INDEX section — free, straight from the
header. Worth stating because it can dominate the download:
causenet-full-typed.rete carries 1.88 GB of it, 29% of the file.
token_table_bytes: Option<u64>Byte length of the section’s leading token table — the prefix a
first search faults, several times smaller than bytes (which counts
the postings blob, fetched one posting at a time). One ≤10-byte range
read; None when there is no index, or its first bytes were unreadable.
Implementations§
Source§impl TextIndexSignal
impl TextIndexSignal
Sourcepub fn probe<R: RangeReader + ?Sized>(reader: &R, header: &Header) -> Self
pub fn probe<R: RangeReader + ?Sized>(reader: &R, header: &Header) -> Self
Measure the signal from a file’s header, through the same
crate::RangeReader the card was read with. Costs nothing beyond
the header already in hand when there is no index, and one ≤10-byte
range read when there is — never the index itself.
Trait Implementations§
Source§impl Clone for TextIndexSignal
impl Clone for TextIndexSignal
impl Copy for TextIndexSignal
Source§impl Debug for TextIndexSignal
impl Debug for TextIndexSignal
Source§impl Default for TextIndexSignal
impl Default for TextIndexSignal
Source§impl<'de> Deserialize<'de> for TextIndexSignal
impl<'de> Deserialize<'de> for TextIndexSignal
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for TextIndexSignal
Source§impl PartialEq for TextIndexSignal
impl PartialEq for TextIndexSignal
Source§impl Serialize for TextIndexSignal
impl Serialize for TextIndexSignal
impl StructuralPartialEq for TextIndexSignal
Auto Trait Implementations§
impl Freeze for TextIndexSignal
impl RefUnwindSafe for TextIndexSignal
impl Send for TextIndexSignal
impl Sync for TextIndexSignal
impl Unpin for TextIndexSignal
impl UnsafeUnpin for TextIndexSignal
impl UnwindSafe for TextIndexSignal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more