How to control Indexing a field in lucene 4.0
Constructors taking Field.Index
arguments are available, but are deprecated in 4.0, and should not be used. Instead, you should look to subclasses of Field
to control how a field is indexed.
StringField
is the standard un-analyzed indexed field. The field is indexed is a single token. It is appropriate things like identifiers, for which you only need to search for exact matches.TextField
is the standard analyzed (and, of course, indexed) field, for textual content. It is an appropriate choice for full-text searching.StoredField
is a stored field that is not indexed at all (and so, is not searchable).
Except StoredField
, each of these can be passed a Field.Store
value as a constructor argument, similar to Lucene 3.6.
For more information on this change, take a look at the Lucene Migration Guide, particularly the sections titled: "Separate IndexableFieldType from Field instances"