using System.Threading.Tasks;
public int BookId { get; set; }
public string Title { get; set; }
public string[] Authors { get; set; }
public string Synopsis { get; set; }
public async static Task Main()
var bookIndex = new FullTextIndexBuilder<int>()
.WithObjectTokenization<Book>(
.WithField("Title", b => b.Title)
.WithField("Authors", b => b.Authors)
.WithField("Synopsis", b => b.Synopsis))
Title = "The Three Body Problem",
Authors = new[] { "Liu Cixin" },
Synopsis = "The Three-Body Problem (Chinese: 三体; literally: 'Three-Body'; pinyin: sān tǐ) is a hard science fiction novel..."
Title = "Dragons of Autumn Twilight",
Authors = new[] { "Margaret Weis", "Tracy Hickman" },
Synopsis = "Dragons of Autumn Twilight is a 1984 fantasy novel by American writers Margaret Weis and Tracy Hickman..."
await bookIndex.AddRangeAsync(books);
var results = bookIndex.Search("novel");
Console.WriteLine($"Matched documents: {String.Join(", ", results.Select(i => i.Key))}");
Console.WriteLine($"with respective scores: {string.Join(", ", results.Select(i => i.Score))}");
results = bookIndex.Search("title=the");
Console.WriteLine("Matched documents: " + string.Join(", ", results.Select(i => i.Key)));