Hi: I am migrating to Lucene 6 from Lucene 5.1. I found out that InPoint does not support sorting as its DocValuesType is frozen to NONE and sorting requires NUMERIC. In Lucene 5.1, I could set the field type of a newmeric field so I could do range based search and sort the result. I know I can migrate to LegacyIntField but I'd like migrate to the new IntPoint instead. Does any one know how to index a numeric value to support both range based query and sorting?
Thank you!
You need to store the value in a NumericDocValuesField or its subclasses.
doc.add(new NumericDocValuesField(field, 10));
Then search docs ranked by this field will be :
Sort sort = new Sort(new SortedNumericSortField(field, SortField.Type.INT, true)); TopDocs topDocs = indexsearcher.search(query, returnedDocNum, sort);
You have to use additional SortedNumericDocValuesField
and make sort based on it