Github user jpountz commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/521#discussion_r240152127
  
    --- Diff: 
lucene/core/src/java/org/apache/lucene/index/NumericDocValuesFieldUpdates.java 
---
    @@ -53,14 +55,28 @@ BytesRef binaryValue() {
     
         @Override
         protected void set(long idx) {
    -      value = values.get(idx);
    +      value = values.get(idx) + minValue;
         }
       }
    -  private PagedGrowableWriter values;
    +  private AbstractPagedMutable values;
    +  private final long minValue;
    +
    +  NumericDocValuesFieldUpdates(long delGen, String field, int maxDoc) {
    +   this(delGen, field, Long.MIN_VALUE, Long.MAX_VALUE, maxDoc);
    +  }
     
    -  public NumericDocValuesFieldUpdates(long delGen, String field, int 
maxDoc) {
    +  NumericDocValuesFieldUpdates(long delGen, String field, long minValue, 
long maxValue, int maxDoc) {
         super(maxDoc, delGen, field, DocValuesType.NUMERIC);
    -    values = new PagedGrowableWriter(1, PAGE_SIZE, 1, PackedInts.FAST);
    +    assert minValue <= maxValue : "minValue must be <= maxValue [" + 
minValue + " > " + maxValue + "]";
    +    long max = maxValue - minValue;
    +    if (max < 0) { // pretty large range - fall back to growable writer
    --- End diff --
    
    It feels a bit weird to optimize when using 64 bits per value but not 63, 
or 62? Not sure if you are aware but `PackedInts.unsignedBitsRequired` can help 
avoid special-casing when max-min overflows.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to