Reputation: 2462
Old version
Newer version
For matching Keyword what would be the difference between
new Field( name, value, Field.Store.YES, Field.Index.NOT_ANALYZED )
and
new Field( name, value, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS )
Matching Unindexed =
new Field( name, value, Field.Store.YES, Field.Index.NO )
And finally what could be the usage of ?
new Field( name, value, Field.Store.NO, Field.Index.NOT_ANALYZED )
Upvotes: 0
Views: 90
Reputation: 33341
The difference between NOT_ANALYZED
and NOT_ANALYZED_NO_NORMS
is that one doesn't have norms. Norms include a small amount of meta-data used in scoring hits. This includes index-time field boost and a length norm. If the field only has one term (as NOT_ANALYZED fields generally do), the length norm isn't really relevant. So, if you don't need to have field boosts at index time, you can safely index with no norms, and save a byte of space per field, per document.
Yes,
new Field( name, value, Field.Store.YES, Field.Index.NO )
Would be a good way to index a stored-only, non-indexed field.
The usage of:
new Field( name, value, Field.Store.NO, Field.Index.NOT_ANALYZED )
Would be to index and make searchable the entire contents of the value without analysis, and not store the value for fetching from the index. The Store value passed in is whether you need to be able to fetch that data from a search result. The Index value controls how you will be able to search for it (if at all).
Not to be confused with:
new Field( name, value, Field.Store.NO, Field.Index.NO )
The usage of that is to throw an IllegalArgumentException
.
Upvotes: 1