Skip to main content

TextIndexSignal

Struct TextIndexSignal 

Source
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: bool

True 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: u64

Byte 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

Source

pub fn probe<R>(reader: &R, header: &Header) -> TextIndexSignal
where R: RangeReader + ?Sized,

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.

Source

pub fn describe(&self) -> String

One line for the human catalog view and the audit report.

Trait Implementations§

Source§

impl Clone for TextIndexSignal

Source§

fn clone(&self) -> TextIndexSignal

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TextIndexSignal

Source§

impl Debug for TextIndexSignal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for TextIndexSignal

Source§

fn default() -> TextIndexSignal

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TextIndexSignal

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<TextIndexSignal, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for TextIndexSignal

Source§

impl PartialEq for TextIndexSignal

Source§

fn eq(&self, other: &TextIndexSignal) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for TextIndexSignal

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TextIndexSignal

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V