Methods Summary |
---|
private void | compute()
// compute optional values
if (computed) {
return;
}
minVal = Float.MAX_VALUE;
maxVal = 0;
float sum = 0;
for (int i=0; i<nVals; i++) {
float val = floatVal(i);
sum += val;
minVal = Math.min(minVal,val);
maxVal = Math.max(maxVal,val);
}
avgVal = sum / nVals;
computed = true;
|
public double | doubleVal(int doc)Return doc value as a double.
Optional: DocValues implementation can (but don't have to) override this method.
return (double) floatVal(doc);
|
public org.apache.lucene.search.Explanation | explain(int doc)Explain the scoring value for the input doc.
return new Explanation(floatVal(doc), toString(doc));
|
public abstract float | floatVal(int doc)Return doc value as a float.
Mandatory: every DocValues implementation must implement at least this method.
|
public float | getAverageValue()Returns the average of all values.
compute();
return avgVal;
|
java.lang.Object | getInnerArray()Expert: for test purposes only, return the inner array of values, or null if not applicable.
Allows tests to verify that loaded values are:
- indeed cached/reused.
- stored in the expected size/type (byte/short/int/float).
Note: Tested implementations of DocValues must override this method for the test to pass!
return new Object[0];
|
public float | getMaxValue()Optional op.
Returns the maximum of all values.
compute();
return maxVal;
|
public float | getMinValue()Optional op.
Returns the minimum of all values.
compute();
return minVal;
|
public int | intVal(int doc)Return doc value as an int.
Optional: DocValues implementation can (but don't have to) override this method.
return (int) floatVal(doc);
|
public long | longVal(int doc)Return doc value as a long.
Optional: DocValues implementation can (but don't have to) override this method.
return (long) floatVal(doc);
|
public java.lang.String | strVal(int doc)Return doc value as a string.
Optional: DocValues implementation can (but don't have to) override this method.
return Float.toString(floatVal(doc));
|
public abstract java.lang.String | toString(int doc)Return a string representation of a doc value, as reuired for Explanations.
|