parse_index_def

Function parse_index_def 

Source
fn parse_index_def(config: IndexConfig) -> Result<IndexDef, ConfigError>
Expand description

Converts an IndexConfig into an IndexDef by parsing the configured index type.

Parses the index_type string and returns an IndexDef preserving the field and options from the input config.

§Returns

Ok(IndexDef) on success; Err(ConfigError::InvalidValue) if the index_type text is not a known index type.

§Examples

let cfg = IndexConfig {
    field: "title".into(),
    index_type: "btree".into(),
    options: vec![],
};
let def = parse_index_def(cfg).unwrap();
assert_eq!(def.field, "title");
assert_eq!(def.options.len(), 0);