Index Construction

Use a FullTextIndexBuilder<TKey> to configure the behavior of your index.

FullTextIndexBuilder<TKey>

FullTextIndexBuilder requires a single generic type provided to it. This defines the type of the key that documents will be indexed against.

In simple cases this will just be a string, Guid, Int32 or UInt32. Indexes can be built with other key types, including composite types, but special care needs to be made when using the binary serializer. See Key Serialization for more information.

Quick examples

Create an index with defaults:

  • case insensitive
  • accent insensitive
  • full LIFTI query syntax for queries (Don’t want this? See WithSimpleQueryParser)
  • no word stemming
  • splitting only on punctuation, whitespace and control characters
var index = new FullTextIndexBuilder<int>()
    .Build();

Enable word stemming:

var index = new FullTextIndexBuilder<int>()
    .WithDefaultTokenizationOptions(o => o.WithStemming())
    .Build();

With object indexing enabled for a Customer type and stemming only enabled for the Notes property:

var index = new FullTextIndexBuilder<int>()
    .WithObjectTokenization<Customer>(o => o
      .WithId(c => c.CustomerId)
      .WithField("Name", c=>c.Name)
      .WithField("Notes", c=>c.Notes, fo => fo.WithStemming())
    )
    .Build();

Default tokenization

Specifies the default tokenization options that should be used when searching or indexing when tokenization options are not explicitly specified for an object type.

Object tokenization

Configure the index to accept a strongly typed object when indexing content.

Managing duplicate keys

Configure how the index should behave when indexing an item that is already present in the index.

Query parser configuration

Configure how the LIFTI query parser should operate for the index.

Thesaurus synonyms

Prescribes how the index should treat terms as synonymous when they are being added to the index.

Document text extraction

Text extraction is the process by which fragments of text are lifted from a larger body of text prior to tokenization.

Using the simple query parser

You can use a simple query parser when you don’t want queries to make use of the full LIFTI query syntax.

Adding index modification actions

You can register an async action that needs to occur when mutations to the index are committed and a new snapshot is generated.

Last modified January 16, 2024: V6.0.0 (#107) (125ae87)