Skip to main content

Profile

Trait Profile 

Source
pub trait Profile: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn version(&self) -> u32;

    // Provided methods
    fn fields(&self) -> &[FieldSpec] { ... }
    fn filters(&self) -> &[&'static str] { ... }
    fn fuzzy_key_map(&self) -> Option<KeyMap> { ... }
    fn min_limit(&self) -> usize { ... }
    fn min_score(&self) -> f64 { ... }
    fn synonyms(&self) -> Option<&Synonyms> { ... }
    fn process_query(&self, query: &str) -> String { ... }
    fn process_tokens(&self, tokens: Vec<Token>) -> Vec<Token> { ... }
    fn make_labels(
        &self,
        doc: &Document,
        housenumber: Option<&str>,
    ) -> Vec<String> { ... }
    fn display_label(
        &self,
        _doc: &Document,
        _housenumber: Option<&str>,
        _query: &str,
    ) -> Option<String> { ... }
}

Required Methods§

Source

fn name(&self) -> &'static str

Stored in the index; must be unique among registered profiles.

Source

fn version(&self) -> u32

Bump whenever token processing changes: an index built with another version would no longer match the queries.

Provided Methods§

Source

fn fields(&self) -> &[FieldSpec]

Indexed text fields, with their boosts.

Source

fn filters(&self) -> &[&'static str]

Document keys usable as search filters.

Source

fn fuzzy_key_map(&self) -> Option<KeyMap>

Keyboard used to limit fuzzy substitutions to neighbouring keys (addok’s FUZZY_KEY_MAP); None tries every letter.

Source

fn min_limit(&self) -> usize

Number of results addok computes at least, whatever the requested limit; the best limit of them are returned. It changes which collectors run (a bucket is “full” or “dry” relative to it).

Source

fn min_score(&self) -> f64

Results scoring below this are dropped (addok’s MIN_SCORE).

Source

fn synonyms(&self) -> Option<&Synonyms>

Synonyms applied to index and query tokens.

Source

fn process_query(&self, query: &str) -> String

addok’s QUERY_PROCESSORS: string cleanup applied to the ASCII folded query only, before tokenizing.

Source

fn process_tokens(&self, tokens: Vec<Token>) -> Vec<Token>

addok’s PROCESSORS after tokenize and normalize, run on index and query text alike.

Source

fn make_labels(&self, doc: &Document, housenumber: Option<&str>) -> Vec<String>

Labels a result is compared against, best one first.

Source

fn display_label( &self, _doc: &Document, _housenumber: Option<&str>, _query: &str, ) -> Option<String>

The label shown for a result, given the ASCII folded query (empty when reverse geocoding). None shows the first label, like addok’s str(result).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§