public void UsesPrecisionStep() { mapper = new NumericReflectionFieldMapper<Sample>(typeof(Sample).GetProperty("Int"), StoreMode.Yes, null, TypeDescriptor.GetConverter(typeof(int)), "Int", 128, 1.0f); var sample = new Sample { Long = 1234L }; var document = new Document(); mapper.CopyToDocument(sample, document); var field = document.GetFieldable("Int"); Assert.That(field.TokenStreamValue.ToString(), Is.EqualTo("(numeric,valSize=32,precisionStep=128)")); }
public void StoreLong() { mapper = new NumericReflectionFieldMapper<Sample>(typeof(Sample).GetProperty("Long"), StoreMode.Yes, null, TypeDescriptor.GetConverter(typeof(long)), "Long", NumericUtils.PRECISION_STEP_DEFAULT, 1.0f); var sample = new Sample { Long = 1234L }; var document = new Document(); mapper.CopyToDocument(sample, document); var field = document.GetFieldable("Long"); Assert.That(field.TokenStreamValue.ToString(), Is.EqualTo("(numeric,valSize=64,precisionStep=4)")); }
public void UsesPrecisionStep() { mapper = new NumericReflectionFieldMapper <Sample>(typeof(Sample).GetProperty("Int"), StoreMode.Yes, null, TypeDescriptor.GetConverter(typeof(int)), "Int", 128, 1.0f); var sample = new Sample { Long = 1234L }; var document = new Document(); mapper.CopyToDocument(sample, document); var field = document.GetFieldable("Int"); Assert.That(field.TokenStreamValue.ToString(), Is.EqualTo("(numeric,valSize=32,precisionStep=128)")); }
public void StoreLong() { mapper = new NumericReflectionFieldMapper <Sample>(typeof(Sample).GetProperty("Long"), StoreMode.Yes, null, TypeDescriptor.GetConverter(typeof(long)), "Long", NumericUtils.PRECISION_STEP_DEFAULT, 1.0f); var sample = new Sample { Long = 1234L }; var document = new Document(); mapper.CopyToDocument(sample, document); var field = document.GetFieldable("Long"); Assert.That(field.TokenStreamValue.ToString(), Is.EqualTo("(numeric,valSize=64,precisionStep=4)")); }