Skip to content

Commit

Permalink
fix var name
Browse files Browse the repository at this point in the history
  • Loading branch information
PSeitz committed Jul 21, 2022
1 parent 5f966d7 commit 90e296f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/fastfield/bytes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mod tests {
use crate::{DocAddress, DocSet, Index, Searcher, Term};

#[test]
fn test_bytes2() -> crate::Result<()> {
fn test_bytes() -> crate::Result<()> {
let mut schema_builder = Schema::builder();
let bytes_field = schema_builder.add_bytes_field("bytesfield", FAST);
let schema = schema_builder.build();
Expand Down
16 changes: 8 additions & 8 deletions src/fastfield/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,27 @@ pub trait FastFieldReader<Item: FastValue>: Clone {
}

struct FFHeader {
field_id: u8,
codec_id: u8,
gcd: u64,
min_value: u64,
}

fn read_header(bytes: &mut OwnedBytes) -> FFHeader {
let magic_number_or_field_id = bytes.read_u8();
if magic_number_or_field_id == FF_HEADER_MAGIC_NUMBER {
let magic_number_or_codec_id = bytes.read_u8();
if magic_number_or_codec_id == FF_HEADER_MAGIC_NUMBER {
let _header_version = bytes.read_u8();
let field_id = bytes.read_u8();
let codec_id = bytes.read_u8();
let gcd = bytes.read_u64();
let min_value = bytes.read_u64();
FFHeader {
field_id,
codec_id,
gcd,
min_value,
}
} else {
// old version
FFHeader {
field_id: magic_number_or_field_id,
codec_id: magic_number_or_codec_id,
gcd: 1,
min_value: 0,
}
Expand Down Expand Up @@ -149,7 +149,7 @@ impl<Item: FastValue> DynamicFastFieldReader<Item> {
let mut bytes = file.read_bytes()?;
let header = read_header(&mut bytes);

Self::open_from_id(bytes, header.field_id, header.gcd, header.min_value)
Self::open_from_id(bytes, header.codec_id, header.gcd, header.min_value)
}
}

Expand Down Expand Up @@ -203,7 +203,7 @@ impl<Item: FastValue, C: FastFieldCodecReader> FastFieldReaderCodecWrapper<Item,
pub fn open(file: FileSlice) -> crate::Result<Self> {
let mut bytes = file.read_bytes()?;
let header = read_header(&mut bytes);
let id = header.field_id;
let id = header.codec_id;
assert_eq!(
BitpackedFastFieldSerializer::ID,
id,
Expand Down
4 changes: 2 additions & 2 deletions src/fastfield/serializer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ impl CompositeFastFieldSerializer {
/// automatically.
pub fn write_header<W: Write>(
field_write: &mut W,
field_id: u8,
codec_id: u8,
stats: FastFieldStats,
gcd: Option<u64>,
) -> io::Result<()> {
FF_HEADER_MAGIC_NUMBER.serialize(field_write)?;
let header_version = 1_u8;
header_version.serialize(field_write)?;

field_id.serialize(field_write)?;
codec_id.serialize(field_write)?;
gcd.unwrap_or(GCD_DEFAULT).serialize(field_write)?;
stats.min_value.serialize(field_write)?;

Expand Down

0 comments on commit 90e296f

Please sign in to comment.