Refine search
/** * 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; }
@Override public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws IOException { LeafReader reader = context.reader(); FieldInfo info = reader.getFieldInfos().fieldInfo(field); if (info != null) { LatLonDocValuesField.checkCompatible(info); } currentDocs = DocValues.getSortedNumeric(reader, field); valuesDocID = -1; return this; }
NumericDocValues singleton = DocValues.unwrapSingleton(sortedNumeric); if (singleton != null) {
/** * 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; } }
@Override protected SortedDocValues getSortedDocValues(LeafReaderContext context, String field) throws IOException { return SortedSetSelector.wrap(DocValues.getSortedSet(context.reader(), field), selector); } };
@Override public Bits docsWithValue(LeafReaderContext context) { final RandomAccessOrds ordinals = ordinalsValues(context); if (DocValues.unwrapSingleton(ordinals) != null) { return DocValues.docsWithValue(DocValues.unwrapSingleton(ordinals), context.reader().maxDoc()); } else { return DocValues.docsWithValue(ordinals, context.reader().maxDoc()); } }
DistanceLeafCollector(LeafReaderContext context) throws IOException { final LeafReader atomicReader = context.reader(); this.docsWithLatitude = DocValues.getDocsWithField( atomicReader, latitudeField ); this.docsWithLongitude = DocValues.getDocsWithField( atomicReader, longitudeField ); this.latitudeValues = DocValues.getNumeric( atomicReader, latitudeField ); this.longitudeValues = DocValues.getNumeric( atomicReader, longitudeField ); this.docBase = context.docBase; }
@Override protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) throws IOException { return SortedNumericSelector.wrap(DocValues.getSortedNumeric(context.reader(), field), selector, type); } };
@Override public LongValues getValues(LeafReaderContext ctx, DoubleValues scores) throws IOException { final NumericDocValues values = DocValues.getNumeric(ctx.reader(), field); return toLongValues(values); }
@Override public AtomicGeoPointFieldData load(LeafReaderContext context) { try { if (indexCreatedBefore2x) { return new GeoPointLegacyDVAtomicFieldData(DocValues.getBinary(context.reader(), fieldName)); } return new GeoPointDVAtomicFieldData(DocValues.getSortedNumeric(context.reader(), fieldName)); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
for (int i = 0; i < size; i++) { LeafReaderContext context = in.leaves().get(i); final LeafReader reader = context.reader(); final FieldInfo fieldInfo = reader.getFieldInfos().fieldInfo(field); if (fieldInfo != null && fieldInfo.getDocValuesType() != DocValuesType.SORTED) { return null; SortedDocValues v = reader.getSortedDocValues(field); if (v == null) { v = DocValues.emptySorted();
for (int i = 0; i < size; i++) { LeafReaderContext context = in.leaves().get(i); final LeafReader reader = context.reader(); final FieldInfo fieldInfo = reader.getFieldInfos().fieldInfo(field); if(fieldInfo != null && fieldInfo.getDocValuesType() != DocValuesType.SORTED_SET){ return null; SortedSetDocValues v = reader.getSortedSetDocValues(field); if (v == null) { v = DocValues.emptySortedSet();
@Override public Scorer scorer(LeafReaderContext context) throws IOException { final SortedNumericDocValues values = DocValues.getSortedNumeric(context.reader(), getField()); final DocIdSetIterator approximation = DocIdSetIterator.all(context.reader().maxDoc()); final TwoPhaseIterator twoPhase = new TwoPhaseIterator(approximation) { @Override public boolean matches() throws IOException { if (values.advanceExact(approximation.docID())) { for (int i = 0; i < values.docValueCount(); i++) { if (contains(BitMixer.mix(values.nextValue()))) { return true; } } return false; } else { return contains(0); } } @Override public float matchCost() { // BitMixer.mix seems to be about 10 ops return 10; } }; return new ConstantScoreScorer(this, score(), twoPhase); }
@Override public void setNextReader(LeafReaderContext readerContext) throws IOException { LeafReader reader = readerContext.reader(); DocValuesType type = getDocValuesType(reader, field); if (type == null || type == DocValuesType.NONE) { values = DocValues.emptyNumeric(); return ; values = DocValues.getNumeric(reader, field); break; final SortedNumericDocValues sorted = DocValues.getSortedNumeric(reader, field); values = DocValues.unwrapSingleton(sorted); if (values == null) { values = new AbstractNumericDocValues() {
@Override public void setNextReader(LeafReaderContext readerContext) throws IOException { LeafReader reader = readerContext.reader(); DocValuesType type = getDocValuesType(reader, field); if (type == null || type == DocValuesType.NONE) { values = DocValues.emptySorted(); return ; values = DocValues.getSorted(reader, field); break; final SortedSetDocValues sorted = DocValues.getSortedSet(reader, field); values = DocValues.unwrapSingleton(sorted); if (values == null) { values = new AbstractSortedDocValues() {
@Override public Scorer scorer(LeafReaderContext context) throws IOException { SortedNumericDocValues values = getValues(context.reader(), field); if (values == null) { return null; final NumericDocValues singleton = DocValues.unwrapSingleton(values); final TwoPhaseIterator iterator; if (singleton != null) {
return null; } else if (size == 1) { return leaves.get(0).reader().getSortedDocValues(field); for (int i = 0; i < size; i++) { LeafReaderContext context = leaves.get(i); SortedDocValues v = context.reader().getSortedDocValues(field); if (v == null) { v = DocValues.emptySorted(); } else { anyReal = true;