Points cannot sort. They can only do range queries. So you need to convert your 128 bit BigInts into a sort-order-preserving byte[] (BigIntegerPoint.encodeDimension should do this correctly), and then index that byte[] using a SortedDocValuesField. Mike McCandless
http://blog.mikemccandless.com On Sat, Aug 27, 2016 at 2:19 PM, Cristian Lorenzetto <cristian.lorenze...@gmail.com> wrote: > pratically if i understand correctly with Points you can not only search > but also to sort values. > If it is so, for what scope i might to use NumericDocValuesField. > My code actually is : > ....... > else if (o instanceof Double) { > final Double i = (Double) o; > if (docvalue) > doc.add(new NumericDocValuesField(key, NumericUtils > .doubleToSortableLong(i))); > > doc.add(new DoublePoint(key, i)); > if (storage) { > doc.add(new StoredField(key, s.serialize(o))); > } > } > > > I wrote so because i my mind i thought > Poiint to use if you want to search > docvalues if you want to sort /groupby > StoredField if you want to store > > > 2016-08-27 20:12 GMT+02:00 Michael McCandless <luc...@mikemccandless.com>: >> >> If it's just 128 bit, do exactly what BigIntegerPoint does. >> Mike McCandless >> >> http://blog.mikemccandless.com >> >> >> On Sat, Aug 27, 2016 at 2:03 PM, Cristian Lorenzetto >> <cristian.lorenze...@gmail.com> wrote: >> > Good suggestion :) I will do it. In the while i used just for 128bit. >> > >> > 2016-08-27 19:51 GMT+02:00 Michael McCandless >> > <luc...@mikemccandless.com>: >> >> >> >> I think to sort properly you must also ensure all byte[] from those >> >> BigIntegers are the same length, and that you sign extend them? >> >> Mike McCandless >> >> >> >> http://blog.mikemccandless.com >> >> >> >> >> >> On Sun, Aug 21, 2016 at 5:50 AM, Cristian Lorenzetto >> >> <cristian.lorenze...@gmail.com> wrote: >> >> > I took a look for bigInteger point but i didnt see no reference for >> >> > sorting, >> >> > and SortedNumericDocValuesField accept long not biginteger. >> >> > >> >> > >> >> > I thought to sort so : >> >> > >> >> > BigInteger bi = (BigInteger) o; >> >> > byte[] b = bi.toByteArray(); >> >> > NumericUtils.bigIntToSortableBytes(bi, BigIntegerPoint.BYTES, b, 0); >> >> > doc.add(new SortedSetDocValuesField(key, new BytesRef(b))); >> >> > >> >> > it is correct and it is the best practice ? >> > >> > > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org