Q:

Lucene 6 adding IntFields

I am a complete Lucene newbie, so sorry if this question is too basic. Googling has not helped. I have some code to migrate Lucene 2 to 5. The old code handles documents as -
Document doc = new Document();
doc.add(new StringField("id", "id1", Field.Store.YES));
doc.add(new IntField("numBooks",10,Field.Store.YES));
...

The new Lucene does not have IntFields anymore. What is the best way to handle them? There is NumericDocValuesField, but this does not have the Field.Store parameter. What is the best 'field' type to use?

A:

Numeric fields like IntField have been replaced by PointValues fields, like IntPoint. As stated in the documentation, you should add a separate StoredField instance if you need it to be stored:
doc.add(new IntPoint("numBooks",10));
doc.add(new StoredField("numBooks", 10));

See the Migration Guide for more information.

