@Override public long longValue() throws IOException { return currentValues.longValue(); }
@Override public long longValue() throws IOException { return currentValues.longValue(); }
@Override public long longValue() throws IOException { return in.longValue(); } }
@Override public long nextValue() throws IOException { return in.longValue(); }
@Override public long longValue() throws IOException { return in.longValue(); }
private float getValueForDoc(int doc) throws IOException { if (currentReaderValues.advanceExact(doc)) { return Float.intBitsToFloat((int) currentReaderValues.longValue()); } else { return missingValue; } }
private long getValueForDoc(int doc) throws IOException { if (currentReaderValues.advanceExact(doc)) { return currentReaderValues.longValue(); } else { return missingValue; } }
@Override public long longValue() throws IOException { return NumericUtils.sortableDoubleBits(in.longValue()); } };
private int getValueForDoc(int doc) throws IOException { if (currentReaderValues.advanceExact(doc)) { return (int) currentReaderValues.longValue(); } else { return missingValue; } }
@Override public double doubleValue() throws IOException { return decoder.applyAsDouble(values.longValue()); }
private double getValueForDoc(int doc) throws IOException { if (currentReaderValues.advanceExact(doc)) { return Double.longBitsToDouble(currentReaderValues.longValue()); } else { return missingValue; } }
@Override public long longValue() throws IOException { return NumericUtils.sortableFloatBits((int) in.longValue()); } };
@Override public float score(int doc, float freq) throws IOException { // if there are no norms, we act as if b=0 float norm; if (norms == null) { norm = k1; } else { if (norms.advanceExact(doc)) { norm = cache[((byte) norms.longValue()) & 0xFF]; } else { norm = cache[0]; } } return weightValue * freq / (freq + norm); }
float getLengthValue(int doc) throws IOException { if (norms == null) { return 1F; } if (norms.advanceExact(doc)) { return normCache[Byte.toUnsignedInt((byte) norms.longValue())]; } else { return 0; } }
@Override public float score(int doc, float freq) throws IOException { final float raw = tf(freq) * weightValue; // compute tf(f)*weight if (norms == null) { return raw; } else { float normValue; if (norms.advanceExact(doc)) { normValue = normTable[(int) (norms.longValue() & 0xFF)]; } else { normValue = 0; } return raw * normValue; // normalize for field } }
private static void checkNumericDocValues(String fieldName, NumericDocValues ndv) throws IOException { int doc; if (ndv.docID() != -1) { throw new RuntimeException("dv iterator for field: " + fieldName + " should start at docID=-1, but got " + ndv.docID()); } // TODO: we could add stats to DVs, e.g. total doc count w/ a value for this field while ((doc = ndv.nextDoc()) != NO_MORE_DOCS) { ndv.longValue(); } }
@Override public Comparable getComparable(int docID) throws IOException { assert docsInOrder(docID); int readerDocID = values.docID(); if (readerDocID < docID) { readerDocID = values.advance(docID); } if (readerDocID == docID) { return Double.longBitsToDouble(values.longValue()); } else { return missingValue; } } };
@Override public Comparable getComparable(int docID) throws IOException { assert docsInOrder(docID); int readerDocID = values.docID(); if (readerDocID < docID) { readerDocID = values.advance(docID); } if (readerDocID == docID) { return Float.intBitsToFloat((int) values.longValue()); } else { return missingValue; } } };
@Override public Comparable getComparable(int docID) throws IOException { assert docsInOrder(docID); int readerDocID = values.docID(); if (readerDocID < docID) { readerDocID = values.advance(docID); } if (readerDocID == docID) { return (int) values.longValue(); } else { return missingValue; } } };
static SortingLeafReader.CachedNumericDVs sortDocValues(int maxDoc, Sorter.DocMap sortMap, NumericDocValues oldDocValues) throws IOException { FixedBitSet docsWithField = new FixedBitSet(maxDoc); long[] values = new long[maxDoc]; while (true) { int docID = oldDocValues.nextDoc(); if (docID == NO_MORE_DOCS) { break; } int newDocID = sortMap.oldToNew(docID); docsWithField.set(newDocID); values[newDocID] = oldDocValues.longValue(); } return new SortingLeafReader.CachedNumericDVs(values, docsWithField); }