Constructing an in-memory full text index
The code to create a new full text index class looks like this:
var index = new FullTextIndex<MyType>();
var updatableIndex = new UpdatableFullTextIndex<MyType>();
From this you can see that all forms of the full text index class are generic types defining the type of item that the index will contain.
There are two approaches that you can take to indexing items: indexing keys and indexing .NET objects.
The first approach is to index a unique key for your items. This means that the index itself will only store a
reference or id to the indexed item. This might be an integer, a string, a Guid or other primitive type.
The constructor for this approach looks like this (Note that the FullTextIndex generic type is
var index = new FullTextIndex<int>()
The main benefit to this approach is that once an item has been indexed the associated text doesn’t need to be retained in memory.
Indexing .NET objects
If your items are always loaded into memory and they contain all the text that you want to index, you can index them directly:
var index = new FullTextIndex<Customer>();
Here the generic type of FullTextIndex is Customer.
Obviously the drawback to this approach is that all the instances are retained in memory, along with all their associated properties, including the text.