private static Field CreateCustomIndexField(string fieldName, string value, bool tokenise)
{
// Store the original field value in the index.
// http://incubator.apache.org/lucene.net/docs/2.1/Lucene.Net.Documents.Field.StoreFields.html
Field.Store store = Field.Store.YES;
Field.Index index;
if (tokenise)
{
// Index the field's value using an Analyzer, so it can be searched.
// http://incubator.apache.org/lucene.net/docs/2.1/Lucene.Net.Documents.Field.IndexMembers.html
index = Field.Index.TOKENIZED;
}
else
{
// Index the field's value without using an Analyzer, so it can't be searched.
// http://incubator.apache.org/lucene.net/docs/2.1/Lucene.Net.Documents.Field.IndexMembers.html
index = Field.Index.UN_TOKENIZED;
}
return new Field(fieldName, value, store, index);
}