diff --git a/src/directory/footer.rs b/src/directory/footer.rs index 41da54f834..70acceebd7 100644 --- a/src/directory/footer.rs +++ b/src/directory/footer.rs @@ -102,10 +102,11 @@ impl Footer { /// Confirms that the index will be read correctly by this version of tantivy /// Has to be called after `extract_footer` to make sure it's not accessing uninitialised memory pub fn is_compatible(&self) -> Result<(), Incompatibility> { + const SUPPORTED_INDEX_FORMAT_VERSION_RANGE: std::ops::RangeInclusive = + INDEX_FORMAT_OLDEST_SUPPORTED_VERSION..=INDEX_FORMAT_VERSION; + let library_version = crate::version(); - if self.version.index_format_version < INDEX_FORMAT_OLDEST_SUPPORTED_VERSION - || self.version.index_format_version > INDEX_FORMAT_VERSION - { + if !SUPPORTED_INDEX_FORMAT_VERSION_RANGE.contains(&self.version.index_format_version) { return Err(Incompatibility::IndexMismatch { library_version: library_version.clone(), index_version: self.version.clone(),