diff --git a/Cargo.toml b/Cargo.toml index 436971b56..d76ddb781 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ byteorder = "0.4" memmap = "0.2" lazy_static = "0.1.*" regex = "0.1" -fst = "0.1.27" +fst = { path = "../fst" } rand = "0.3.13" atomicwrites = "0.0.14" tempfile = "2.0.0" diff --git a/src/core/reader.rs b/src/core/reader.rs index d59bd067f..12260a81f 100644 --- a/src/core/reader.rs +++ b/src/core/reader.rs @@ -14,6 +14,12 @@ use core::postings::Postings; use core::simdcompression::Decoder; use std::io::Error as IOError; use std::io::ErrorKind; +use std::io; + +fn convert_fst_error(e: fst::Error) -> io::Error { + io::Error::new(io::ErrorKind::Other, e) +} + // TODO file structure should be in codec @@ -99,9 +105,9 @@ impl SegmentReader { pub fn open(segment: Segment) -> Result { let term_shared_mmap = try!(segment.mmap(SegmentComponent::TERMS)); - let term_offsets = fst::Map::from_mmap(term_shared_mmap) - .map_err(|e| IOError::new(ErrorKind::Other, e)) - .unwrap(); + let fst = try!(fst::raw::Fst::from_mmap(term_shared_mmap) + .map_err(convert_fst_error)); + let term_offsets = fst::Map::from(fst); let store_reader = StoreReader::new(try!(segment.mmap(SegmentComponent::STORE))); let postings_shared_mmap = try!(segment.mmap(SegmentComponent::POSTINGS)); Ok(SegmentReader {