pub struct SearchView { /* private fields */ }Expand description
A .rete opened for search only: the dictionary’s chunk directories, and
the TEXT_INDEX / pyramid deferred behind their lazy slots. Nothing else.
What makes this cheap is skipping dictionary sections 2 and 3 (object-only
and predicates) — NOT skipping the index. Measured on the published
epfl-infoscience.rete (1.64 GB), a full Rete::open_ranged_lazy reads
536,947,344 B, of which the six permutation tile directories are 49,940 B
in 40 reads and the dictionary is 536,896,380 B in 36 reads: the
object-only chunk directory alone is 234,400,728 B, because that file stores
every chunk’s first term verbatim. Files built since #198 key it by the
shortest separator (~600 KB on this graph); the published one still does
not, and only a rebuild changes that. This view opens sections 0 and 1
only — both search modes return subject IRIs — and costs 21,554 B in 9
reads on the same file. It also skips the index container and defers the
TEXT_INDEX and pyramid, so it pays only for what it reads: the token table
on the first search, then one range per posting list and per dictionary
chunk holding a matched subject. This is what backs rete search-url.
Implementations§
Source§impl SearchView
impl SearchView
Sourcepub fn open_ranged<R>(reader: R) -> Result<SearchView, FileError>
pub fn open_ranged<R>(reader: R) -> Result<SearchView, FileError>
Open for search over any RangeReader (HTTP or local): header +
dictionary chunk directories only, with the text index and pyramid
faulting in on first use.
Sourcepub fn header(&self) -> &Header
pub fn header(&self) -> &Header
The file header (already fetched by open_ranged).
Sourcepub fn has_text_index(&self) -> bool
pub fn has_text_index(&self) -> bool
Whether the file carries a TEXT_INDEX section — a header read, no fault.
Sourcepub fn has_pyramid(&self) -> bool
pub fn has_pyramid(&self) -> bool
Whether the file carries a pyramid (where the label index lives) — a header read, no fault.
Sourcepub fn text_search(
&self,
words: &[&str],
prefix: Option<&str>,
limit: usize,
) -> Vec<String>
pub fn text_search( &self, words: &[&str], prefix: Option<&str>, limit: usize, ) -> Vec<String>
Full-text search — see Rete::text_search for the semantics. Faults
the token table on the first call, then only the queried postings.
Sourcepub fn text_index_token_table_len(&self) -> Option<u64>
pub fn text_index_token_table_len(&self) -> Option<u64>
What that first search will cost — see
Rete::text_index_token_table_len. One ≤10-byte range read, so a
caller can quote the figure before deciding to search.
Sourcepub fn prefix_search(&self, prefix: &str, limit: usize) -> Vec<(String, String)>
pub fn prefix_search(&self, prefix: &str, limit: usize) -> Vec<(String, String)>
Label-prefix search — see Rete::prefix_search. Faults the pyramid
(which carries the label index), so it is the pricier of the two.