They are fully supported, so you can write and read them.

The problem with negative numbers is that they need lot of (disk) space, 
because in two's complement they have almost all bits set. The largest number 
is kinds of disk space is -1.

Negative numbers appear in older index formats, so they can't be prevented by a 
pull request as suggested.

Just take the comment as given: all is supported, but if you want to store 
negative numbers use a different encoding, e.g. zigzag.

Uwe

Am 3. September 2021 14:34:35 UTC schrieb Aaron Cohen 
<aaronmichaelco...@me.com.INVALID>:
>While reading the Lucene JavaDoc I came across writeVInt 
><https://lucene.apache.org/core/8_9_0/core/org/apache/lucene/store/DataOutput.html#writeVInt-int->
> & readVInt 
><https://lucene.apache.org/core/8_9_0/core/org/apache/lucene/store/DataInput.html#readVInt-->
> from DataOutput and DataInput base classes. It says for writeVint
>
>Parameters:
>i - Smaller values take fewer bytes. Negative numbers are supported, but 
>should be avoided.
>
>And for readVint "Negative numbers are supported, but should be avoided.”
>
>This seems like an odd statement. Why would something be supported but should 
>be avoided? Should I submit a PR to prevent negative integers?
--
Uwe Schindler
Achterdiek 19, 28357 Bremen
https://www.thetaphi.de

Reply via email to