pub fn open_or_create<Dir: Directory>(dir: Dir, schema: Schema) -> Result<Index> {
        if Index::exists(&dir) {
            let index = Index::open(dir)?;
            if index.schema() == schema {
                Ok(index)
            } else {
                Err(TantivyError::SchemaError(
                    "An index exists but the schema does not match.".to_string(),
                ))
            }
        } else {
            Index::create(dir, schema)
        }
    }
/// Opens or creates a new index in the provided directory
Opens or creates a new index in the provided directory
Opens or creates a new index in the provided directory
pub fn open_or_create<Dir: Directory>(dir: Dir, schema: Schema) -> Result<Index> {
        if Index::exists(&dir) {
            let index = Index::open(dir)?;
            if index.schema() == schema {
                Ok(index)
            } else {
                Err(TantivyError::SchemaError(
                    "An index exists but the schema does not match.".to_string(),
                ))
            }
        } else {
            Index::create(dir, schema)
        }
    }
pub fn open_or_create < Dir : Directory > ( dir : Dir , schema : Schema ) -> Result < Index > { if Index :: exists ( & dir ) { let index = Index :: open ( dir ) ? ; if index . schema ( ) == schema { Ok ( index ) } else { Err ( TantivyError :: SchemaError ( " " . to_string ( ) , ) ) } } else { Index :: create ( dir , schema ) } }
Opens or creates a new index in the provided directory
Opens or creates a new index in the provided directory
dir
Dir
schema
Schema
dir
Dir
schema
Schema