/** * Returns NumericDocValues for the field, or {@link #emptyNumeric()} 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#NUMERIC}. * @throws IOException if an I/O error occurs. */ public static NumericDocValues getNumeric(LeafReader reader, String field) throws IOException { NumericDocValues dv = reader.getNumericDocValues(field); if (dv == null) { checkField(reader, field, DocValuesType.NUMERIC); return emptyNumeric(); } else { return dv; } }
/** * Returns SortedDocValues for the field, or {@link #emptySorted} 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}. * @throws IOException if an I/O error occurs. */ public static SortedDocValues getSorted(LeafReader reader, String field) throws IOException { SortedDocValues dv = reader.getSortedDocValues(field); if (dv == null) { checkField(reader, field, DocValuesType.SORTED); return emptySorted(); } else { return dv; } }
/** * Returns BinaryDocValues for the field, or {@link #emptyBinary} 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#BINARY} * or {@link DocValuesType#SORTED}. * @throws IOException if an I/O error occurs. */ public static BinaryDocValues getBinary(LeafReader reader, String field) throws IOException { BinaryDocValues dv = reader.getBinaryDocValues(field); if (dv == null) { dv = reader.getSortedDocValues(field); if (dv == null) { checkField(reader, field, DocValuesType.BINARY, DocValuesType.SORTED); return emptyBinary(); } } return dv; }
/** * 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; }
/** * Returns NumericDocValues for the field, or {@link #emptyNumeric()} 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#NUMERIC}. * @throws IOException if an I/O error occurs. */ public static NumericDocValues getNumeric(LeafReader reader, String field) throws IOException { NumericDocValues dv = reader.getNumericDocValues(field); if (dv == null) { checkField(reader, field, DocValuesType.NUMERIC); return emptyNumeric(); } else { return dv; } }
/** * Returns SortedDocValues for the field, or {@link #emptySorted} 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}. * @throws IOException if an I/O error occurs. */ public static SortedDocValues getSorted(LeafReader reader, String field) throws IOException { SortedDocValues dv = reader.getSortedDocValues(field); if (dv == null) { checkField(reader, field, DocValuesType.SORTED); return emptySorted(); } else { return dv; } }
/** * Returns NumericDocValues for the field, or {@link #emptyNumeric()} 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#NUMERIC}. * @throws IOException if an I/O error occurs. */ public static NumericDocValues getNumeric(LeafReader reader, String field) throws IOException { NumericDocValues dv = reader.getNumericDocValues(field); if (dv == null) { checkField(reader, field, DocValuesType.NUMERIC); return emptyNumeric(); } else { return dv; } }
/** * Returns SortedDocValues for the field, or {@link #emptySorted} 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}. * @throws IOException if an I/O error occurs. */ public static SortedDocValues getSorted(LeafReader reader, String field) throws IOException { SortedDocValues dv = reader.getSortedDocValues(field); if (dv == null) { checkField(reader, field, DocValuesType.SORTED); return emptySorted(); } else { return dv; } }
/** * Returns SortedDocValues for the field, or {@link #emptySorted} 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}. * @throws IOException if an I/O error occurs. */ public static SortedDocValues getSorted(LeafReader reader, String field) throws IOException { SortedDocValues dv = reader.getSortedDocValues(field); if (dv == null) { checkField(reader, field, DocValuesType.SORTED); return emptySorted(); } else { return dv; } }
/** * Returns NumericDocValues for the field, or {@link #emptyNumeric()} 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#NUMERIC}. * @throws IOException if an I/O error occurs. */ public static NumericDocValues getNumeric(LeafReader reader, String field) throws IOException { NumericDocValues dv = reader.getNumericDocValues(field); if (dv == null) { checkField(reader, field, DocValuesType.NUMERIC); return emptyNumeric(); } else { return dv; } }
/** * Returns BinaryDocValues for the field, or {@link #emptyBinary} 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#BINARY} * or {@link DocValuesType#SORTED}. * @throws IOException if an I/O error occurs. */ public static BinaryDocValues getBinary(LeafReader reader, String field) throws IOException { BinaryDocValues dv = reader.getBinaryDocValues(field); if (dv == null) { dv = reader.getSortedDocValues(field); if (dv == null) { checkField(reader, field, DocValuesType.BINARY, DocValuesType.SORTED); return emptyBinary(); } } return dv; }
/** * Returns BinaryDocValues for the field, or {@link #emptyBinary} 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#BINARY} * or {@link DocValuesType#SORTED}. * @throws IOException if an I/O error occurs. */ public static BinaryDocValues getBinary(LeafReader reader, String field) throws IOException { BinaryDocValues dv = reader.getBinaryDocValues(field); if (dv == null) { dv = reader.getSortedDocValues(field); if (dv == null) { checkField(reader, field, DocValuesType.BINARY, DocValuesType.SORTED); return emptyBinary(); } } return dv; }
/** * Returns BinaryDocValues for the field, or {@link #emptyBinary} 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#BINARY} * or {@link DocValuesType#SORTED}. * @throws IOException if an I/O error occurs. */ public static BinaryDocValues getBinary(LeafReader reader, String field) throws IOException { BinaryDocValues dv = reader.getBinaryDocValues(field); if (dv == null) { dv = reader.getSortedDocValues(field); if (dv == null) { checkField(reader, field, DocValuesType.BINARY, DocValuesType.SORTED); return emptyBinary(); } } return dv; }
/** * 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(); } return singleton(sorted); } return dv; }
/** * 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 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(); } return singleton(sorted); } return dv; }
/** * Returns Bits for the field, or {@link Bits} matching nothing if it has none. * @return bits 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 IOException if an I/O error occurs. */ public static Bits getDocsWithField(LeafReader reader, String field) throws IOException { Bits dv = reader.getDocsWithField(field); if (dv == null) { assert DocValuesType.values().length == 6; // we just don't want NONE checkField(reader, field, DocValuesType.BINARY, DocValuesType.NUMERIC, DocValuesType.SORTED, DocValuesType.SORTED_NUMERIC, DocValuesType.SORTED_SET); return new Bits.MatchNoBits(reader.maxDoc()); } else { 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; }
/** * 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()); } Bits bits = reader.getDocsWithField(field); return singleton(single, bits); } return dv; }