Hi there, I'm migrating an application from Lucene 4.7.0 to Lucene 6.0.1. I'm facing a problem with this piece of code :
public List<Object> getDistinctValues(IndexReader reader, EventField field) throws IOException { List<Object> values = new ArrayList<Object>(); Fields fields = MultiFields.getFields(reader); if (fields == null) return values; Terms terms = fields.terms(field.name()); if (terms == null) return values; TermsEnum iterator = terms.iterator(); Class<? extends Object> type = field.getJavaType(); BytesRef value = iterator.next(); while (value != null) { if (type == Long.class) { values.add(LegacyNumericUtils.prefixCodedToLong(value)); } else if (type == Integer.class) { values.add(LegacyNumericUtils.prefixCodedToInt(value)); } else if (type == Boolean.class) { values.add(LegacyNumericUtils.prefixCodedToInt(value) == 1 ? TRUE : FALSE); } else if (type == Date.class) { values.add(new Date(LegacyNumericUtils.prefixCodedToLong(value))); } else if (type == String.class) { values.add(value.utf8ToString()); } else { log.warn("getDistinctValues: ignoring field " + field + " of type " + type); } value = iterator.next(); } return values; } The aim of this method is to get all terms present in a field directly in the correct java type. I'm seeing just now that NumericUtils is an internal class, so I should not have used it. For now, I can use LegacyNumericUtils, but that's a very temporary solution. What is the best approach to achieve my goal ? Thanks in advance for any help. Ludovic [[ rethink everything. ]]<http://www.lombardodier.com> DISCLAIMER ********************************************** This message is intended only for use by the person to whom it is addressed. It may contain information that is privileged and confidential. Its content does not constitute a formal commitment by Bank Lombard Odier & Co Ltd or any of its branches or affiliates. If you are not the intended recipient of this message, kindly notify the sender immediately and destroy this message. Thank You. ***************************************************************