pub struct HelpSearchIndex { /* private fields */ }Expand description
A validated, owned view of the four matrices in Meta/hsearch.rds.
The matrices and their rows retain the stored order, duplicate values,
empty strings, and R NA values. This is a metadata reader only: it does
not implement utils::help.search() matching, ranking, or cross-package
lookup policy.
Implementations§
Source§impl HelpSearchIndex
impl HelpSearchIndex
Sourcepub fn read_installed(
package_dir: impl AsRef<Path>,
) -> Result<Option<Self>, Error>
pub fn read_installed( package_dir: impl AsRef<Path>, ) -> Result<Option<Self>, Error>
Reads Meta/hsearch.rds below an explicitly named installed-package
directory.
Ok(None) means that the file is absent. A present, valid empty
index is returned as Ok(Some(index)); all decoding and schema errors
are returned as errors.
Sourcepub fn read_installed_with_options(
package_dir: impl AsRef<Path>,
options: &ReadOptions,
) -> Result<Option<Self>, Error>
pub fn read_installed_with_options( package_dir: impl AsRef<Path>, options: &ReadOptions, ) -> Result<Option<Self>, Error>
Reads installed help-search metadata with explicit RDS read options.
Sourcepub fn from_object(root: &RObject) -> Result<Self, Error>
pub fn from_object(root: &RObject) -> Result<Self, Error>
Validates and copies a decoded Meta/hsearch.rds object.
The root must be an unnamed list of four character matrices. Current
R schemas use Package, LibPath, ID, Name, Title, Topic, Encoding for
the first matrix and singular Alias, Keyword, and Concept names
for the remaining matrices. The known R 1.8/R 2.9-compatible lower-case
topic columns, plural relation names, and six- or seven-column forms
without or with Encoding are accepted as bounded compatibility cases.
Matrix column order is resolved by column name, but unknown, missing,
duplicate, or NA column names are rejected. A missing legacy Encoding
column is represented as Some(""), matching R’s compatibility reader.
Historical compatibility is limited to these documented shapes; this
does not promise decoding every file produced by every old R release.
RDS serialization versions 2 and 3 are accepted according to the
profiles supported by rd-rds.
Sourcepub fn base_entries(
&self,
) -> impl ExactSizeIterator<Item = &HelpSearchBaseEntry>
pub fn base_entries( &self, ) -> impl ExactSizeIterator<Item = &HelpSearchBaseEntry>
Iterates over help-file rows in stored order.
Sourcepub fn aliases(&self) -> impl ExactSizeIterator<Item = &HelpSearchAliasEntry>
pub fn aliases(&self) -> impl ExactSizeIterator<Item = &HelpSearchAliasEntry>
Iterates over alias rows in stored order.
Sourcepub fn keywords(&self) -> impl ExactSizeIterator<Item = &HelpSearchKeywordEntry>
pub fn keywords(&self) -> impl ExactSizeIterator<Item = &HelpSearchKeywordEntry>
Iterates over keyword rows in stored order.
Sourcepub fn concepts(&self) -> impl ExactSizeIterator<Item = &HelpSearchConceptEntry>
pub fn concepts(&self) -> impl ExactSizeIterator<Item = &HelpSearchConceptEntry>
Iterates over concept rows in stored order.
Sourcepub fn aliases_len(&self) -> usize
pub fn aliases_len(&self) -> usize
Returns the number of stored alias rows.
Sourcepub fn keywords_len(&self) -> usize
pub fn keywords_len(&self) -> usize
Returns the number of stored keyword rows.
Sourcepub fn concepts_len(&self) -> usize
pub fn concepts_len(&self) -> usize
Returns the number of stored concept rows.