v5.0.0
New features in v5.0.0
- Dynamic fields
- More detailed field information
- Smaller binary serialized files
Acknowledgements
Thanks to @kampilan and @h0lg for their thoughts on the design for dynamic fields!
Dynamic fields
v5.0.0 introduces support for dynamic fields, where fields are dynamically registered with the index as it is populated:
var index = new FullTextIndexBuilder<int>()
.WithObjectTokenization<Customer>(o => o
.WithKey(c => c.Id)
.WithDynamicFields("Tags", c => c.TagDictionary, "Tag_")
.WithDynamicFields(
"Questions",
c => c.Questions,
q => q.QuestionName,
q => q.QuestionResponse,
"Question_")
)
.Build();
Indexing this object against the index:
new Customer
{
Tags = new Dictionary<string, string>
{
{ "Foo", "Some text here" }
},
Questions = new List<Question>
{
new Question { QuestionName = "FavoriteColor", QuestionResponse = "My favorite color is blue" }
}
}
Will cause two fields to be registered with text:
Tag_Foo -> "Some text here"
Question_FavouriteColor -> "My favorite color is blue"
More detailed field information
The FieldLookup
property of an index now provides additional information about fields.
Smaller binary serialized files
The binary serializer has been rewritten to support dynamic fields. In addition to this it will now write integers in a variable length encoding, using a few bytes as possible. When serialized using this new approach, indexes will be about 30-50% of the size when the old serializer was used.
Old serialized versions of the index can still be read, as long as the index builder definition remains unchanged.
Breaking Changes
None of these should affect you unless you're doing something really off-the-wall and unexpected.
IIndexedFieldLookup
has new methods on it, IsKnownField
and AllFieldNames
.
IndexedFieldDetails
has changed from being a struct
to an abstract class
and no longer implements IEquatable<IndexedFieldDetails>
.
The IndexedFieldLookup
class is now internal
.