Just index ints as longs; the codec under the hood should be efficient about storing the bytes (ie, not use more than 4 bytes per doc).
For float/double, use Float.floatToRawIntBits / Double.doubleToRawLongBits. Mike McCandless http://blog.mikemccandless.com On Wed, Mar 5, 2014 at 7:47 AM, Yonghui Zhao <zhaoyong...@gmail.com> wrote: > Yes it works. > > I can use AtomicReader.getDocsWithField and NumericDocValues to implement > my requirement for long by doing a sort. > But how to deal with other numeric type(int, float, double)? > > > > 2014-03-05 20:19 GMT+08:00 Michael McCandless <luc...@mikemccandless.com>: > >> Just use AtomicReader.getDocsWithField to know whether the doc had that >> field? >> >> Mike McCandless >> >> http://blog.mikemccandless.com >> >> >> On Wed, Mar 5, 2014 at 7:00 AM, Yonghui Zhao <zhaoyong...@gmail.com> >> wrote: >> > Hi, >> > >> > Is there any data type in lucene can support functions like >> SortedDocValues >> > for any numeric(int, long, float, double) type. >> > >> > SortedDocValues only supports bytes, I want some data type can get >> numeric >> > value and ord(-1 for doc doesn't have the field) for each doc. >> > >> > NumericDocValues only supports long type and doesn't support ord >> function, >> > for the doc doesn't contain the field NumericDocValues will return 0, >> which >> > has no discrimination. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org >> For additional commands, e-mail: java-user-h...@lucene.apache.org >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org