What is the best way to add fields to a document now that Field.Index is deprecated.
Here is what I am doing and what most example online suggest:
doc.add(new Field("id", dbID, Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
What is the new recommended way to set Index properties on Fields with Field.Index going away?
Use org.apache.lucene.document.StoredField
for the fields that you don’t want to index.
Refer
http://lucene.apache.org/core/4_6_0/core/org/apache/lucene/document/StoredField.html
to know about the various available constructors.
example:
StoredField strField = new StoredField("id", bag.getId());
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With