Save the Field Configuration
After running Init() at least once, you can save the field configuration to a file. This lets you skip Init on subsequent loads.
First run — analyze, configure fields, save:
var engine = new SearchEngine();
using var initStream = File.OpenRead("data/imdb_top10k.json");
engine.Init(initStream);
engine.TrySetFieldConfiguration([
new FieldProxy { FieldName = "Movie_Name", Searchable = true, Weight = 2.0f },
new FieldProxy { FieldName = "Stars", Searchable = true, Facetable = true, Weight = 0.75f },
new FieldProxy { FieldName = "Description", Searchable = true, Weight = 1.0f },
new FieldProxy { FieldName = "Year_of_Release", Facetable = true },
], out string error);
engine.SaveFieldConfiguration("fieldconfig.json");
// ... load and indexSubsequent loads — skip Init, load config from file:
var engine = new SearchEngine();
engine.LoadFieldConfiguration("fieldconfig.json");
// ... load and index