@Override SortedNumericDocValues getValues(LeafReader reader, String field) throws IOException { NumericDocValues values = reader.getNumericDocValues(field); if (values == null) { return null; } return DocValues.singleton(values); } };
@Override public SortedNumericDocValues getSortedNumeric(FieldInfo field) throws IOException { return DocValues.singleton(valuesProducer.getNumeric(field)); } });
@Override SortedSetDocValues getValues(LeafReader reader, String field) throws IOException { return DocValues.singleton(DocValues.getSorted(reader, field)); } };
/** * Returns SortedSetDocValues for the field, or {@link #emptySortedSet} if it has none. * @return docvalues instance, or an empty instance if {@code field} does not exist in this reader. * @throws IllegalStateException if {@code field} exists, but was not indexed with docvalues. * @throws IllegalStateException if {@code field} has docvalues, but the type is not {@link DocValuesType#SORTED_SET} * or {@link DocValuesType#SORTED}. * @throws IOException if an I/O error occurs. */ public static SortedSetDocValues getSortedSet(LeafReader reader, String field) throws IOException { SortedSetDocValues dv = reader.getSortedSetDocValues(field); if (dv == null) { SortedDocValues sorted = reader.getSortedDocValues(field); if (sorted == null) { checkField(reader, field, DocValuesType.SORTED, DocValuesType.SORTED_SET); return emptySortedSet(); } dv = singleton(sorted); } return dv; }
/** * Returns SortedNumericDocValues for the field, or {@link #emptySortedNumeric} if it has none. * @return docvalues instance, or an empty instance if {@code field} does not exist in this reader. * @throws IllegalStateException if {@code field} exists, but was not indexed with docvalues. * @throws IllegalStateException if {@code field} has docvalues, but the type is not {@link DocValuesType#SORTED_NUMERIC} * or {@link DocValuesType#NUMERIC}. * @throws IOException if an I/O error occurs. */ public static SortedNumericDocValues getSortedNumeric(LeafReader reader, String field) throws IOException { SortedNumericDocValues dv = reader.getSortedNumericDocValues(field); if (dv == null) { NumericDocValues single = reader.getNumericDocValues(field); if (single == null) { checkField(reader, field, DocValuesType.SORTED_NUMERIC, DocValuesType.NUMERIC); return emptySortedNumeric(reader.maxDoc()); } return singleton(single); } return dv; }
SortedNumericEntry entry = sortedNumerics.get(field.name); if (entry.numValues == entry.numDocsWithField) { return DocValues.singleton(getNumeric(entry));
SortedSetEntry entry = sortedSets.get(field.name); if (entry.singleValueEntry != null) { return DocValues.singleton(getSorted(entry.singleValueEntry));
@Override public SortedSetDocValues ordinals(ValuesHolder values) { return (SortedSetDocValues) DocValues.singleton(new Docs(this, values)); }
@Override public SortedSetDocValues getOrdinalsValues() { final BytesRef term = new BytesRef(value); final SortedDocValues sortedValues = new AbstractSortedDocValues() { private int docID = -1; @Override public BytesRef lookupOrd(int ord) { return term; } @Override public int getValueCount() { return 1; } @Override public int ordValue() { return 0; } @Override public boolean advanceExact(int target) throws IOException { docID = target; return true; } @Override public int docID() { return docID; } }; return (SortedSetDocValues) DocValues.singleton(sortedValues); }
@Override public SortedSetDocValues ordinals(ValuesHolder values) { if (multiValued) { return new MultiDocs(this, values); } else { return (SortedSetDocValues) DocValues.singleton(new SingleDocs(this, values)); } }
/** * Wrap the provided {@link SortedNumericDoubleValues} instance to cast all values to longs. */ public static SortedNumericDocValues castToLong(final SortedNumericDoubleValues values) { final NumericDoubleValues singleton = unwrapSingleton(values); if (singleton != null) { return DocValues.singleton(new LongCastedValues(singleton)); } else { return new SortedLongCastedValues(values); } }
addTermsDict(DocValues.singleton(valuesProducer.getSorted(field)));
/** * Given a {@link SortedNumericDoubleValues}, return a * {@link SortedNumericDocValues} instance that will translate double values * to sortable long bits using * {@link org.apache.lucene.util.NumericUtils#doubleToSortableLong(double)}. */ public static SortedNumericDocValues toSortableLongBits(SortedNumericDoubleValues values) { final NumericDoubleValues singleton = unwrapSingleton(values); if (singleton != null) { final NumericDocValues longBits; if (singleton instanceof SortableLongBitsToNumericDoubleValues) { longBits = ((SortableLongBitsToNumericDoubleValues) singleton).getLongValues(); } else { longBits = new SortableLongBitsNumericDocValues(singleton); } return DocValues.singleton(longBits); } else { if (values instanceof SortableLongBitsToSortedNumericDoubleValues) { return ((SortableLongBitsToSortedNumericDoubleValues) values).getLongValues(); } else { return new SortableLongBitsSortedNumericDocValues(values); } } }
/** * An empty SortedDocValues which returns {@link SortedSetDocValues#NO_MORE_ORDS} for every document */ public static final RandomAccessOrds emptySortedSet() { return singleton(emptySorted()); }
@Override SortedNumericDocValues getValues(LeafReader reader, String field) throws IOException { NumericDocValues values = reader.getNumericDocValues(field); if (values == null) { return null; } return DocValues.singleton(values); } };
/** * An empty SortedDocValues which returns {@link SortedSetDocValues#NO_MORE_ORDS} for every document */ public static final RandomAccessOrds emptySortedSet() { return singleton(emptySorted()); }
/** * An empty SortedNumericDocValues which returns zero values for every document */ public static final SortedNumericDocValues emptySortedNumeric(int maxDoc) { return singleton(emptyNumeric(), new Bits.MatchNoBits(maxDoc)); }
/** * An empty SortedNumericDocValues which returns zero values for every document */ public static final SortedNumericDocValues emptySortedNumeric(int maxDoc) { return singleton(emptyNumeric(), new Bits.MatchNoBits(maxDoc)); }
/** * Wrap the provided {@link SortedNumericDoubleValues} instance to cast all values to longs. */ public static SortedNumericDocValues castToLong(final SortedNumericDoubleValues values) { final NumericDoubleValues singleton = unwrapSingleton(values); if (singleton != null) { return DocValues.singleton(new LongCastedValues(singleton)); } else { return new SortedLongCastedValues(values); } }
/** * Wrap the provided {SortedNumericDoubleValues} instance to cast all values to longs. */ public static SortedNumericDocValues castToLong(final SortedNumericDoubleValues values) { final NumericDoubleValues singleton = unwrapSingleton(values); if (singleton != null) { final Bits docsWithField = unwrapSingletonBits(values); return DocValues.singleton(new LongCastedValues(singleton), docsWithField); } else { return new SortedLongCastedValues(values); } }