@Override public BinaryDocValues getBinary(FieldInfo field) throws IOException { return reader.getBinaryDocValues(field.name); }
@Override public BinaryDocValues getBinaryDocValues(final String field) throws IOException { return isMeta(field) ? in.getBinaryDocValues(field) : null; }
@Override public BinaryDocValues getBinaryDocValues(String field) throws IOException { ensureOpen(); LeafReader reader = fieldToReader.get(field); return reader == null ? null : reader.getBinaryDocValues(field); }
@Override public BinaryDocValues getBinaryDocValues(String field) throws IOException { ensureOpen(); return in.getBinaryDocValues(field); }
@Override public int nextDoc() throws IOException { while (true) { while (currentValues == null) { if (nextLeaf == leaves.size()) { docID = NO_MORE_DOCS; return docID; } currentLeaf = leaves.get(nextLeaf); currentValues = currentLeaf.reader().getBinaryDocValues(field); nextLeaf++; } int newDocID = currentValues.nextDoc(); if (newDocID == NO_MORE_DOCS) { currentValues = null; continue; } else { docID = currentLeaf.docBase + newDocID; return docID; } } }
@Override public boolean advanceExact(int targetDocID) throws IOException { if (targetDocID < docID) { throw new IllegalArgumentException("can only advance beyond current document: on docID=" + docID + " but targetDocID=" + targetDocID); } int readerIndex = ReaderUtil.subIndex(targetDocID, leaves); if (readerIndex >= nextLeaf) { if (readerIndex == leaves.size()) { throw new IllegalArgumentException("Out of range: " + targetDocID); } currentLeaf = leaves.get(readerIndex); currentValues = currentLeaf.reader().getBinaryDocValues(field); nextLeaf = readerIndex+1; } docID = targetDocID; if (currentValues == null) { return false; } return currentValues.advanceExact(targetDocID - currentLeaf.docBase); }
/** * 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; }
@Override public int advance(int targetDocID) throws IOException { if (targetDocID <= docID) { throw new IllegalArgumentException("can only advance beyond current document: on docID=" + docID + " but targetDocID=" + targetDocID); } int readerIndex = ReaderUtil.subIndex(targetDocID, leaves); if (readerIndex >= nextLeaf) { if (readerIndex == leaves.size()) { currentValues = null; docID = NO_MORE_DOCS; return docID; } currentLeaf = leaves.get(readerIndex); currentValues = currentLeaf.reader().getBinaryDocValues(field); nextLeaf = readerIndex+1; if (currentValues == null) { return nextDoc(); } } int newDocID = currentValues.advance(targetDocID - currentLeaf.docBase); if (newDocID == NO_MORE_DOCS) { currentValues = null; return nextDoc(); } else { docID = currentLeaf.docBase + newDocID; return docID; } }
@Override public BinaryDocValues getBinaryDocValues(String field) throws IOException { final BinaryDocValues oldDocValues = in.getBinaryDocValues(field); if (oldDocValues == null) return null; CachedBinaryDVs dvs; synchronized (cachedBinaryDVs) { dvs = cachedBinaryDVs.get(field); if (dvs == null) { FixedBitSet docsWithField = new FixedBitSet(maxDoc()); BytesRef[] values = new BytesRef[maxDoc()]; while (true) { int docID = oldDocValues.nextDoc(); if (docID == NO_MORE_DOCS) { break; } int newDocID = docMap.oldToNew(docID); docsWithField.set(newDocID); values[newDocID] = BytesRef.deepCopyOf(oldDocValues.binaryValue()); } dvs = new CachedBinaryDVs(values, docsWithField); cachedBinaryDVs.put(field, dvs); } } return new SortingBinaryDocValues(dvs); }
break; case BINARY: iterator = reader.getBinaryDocValues(field); break; case SORTED:
return null; } else if (size == 1) { return leaves.get(0).reader().getBinaryDocValues(field);
break; case BINARY: reader.getBinaryDocValues(info.name); break; case SORTED:
@Override public Scorer scorer(LeafReaderContext context) throws IOException { final BinaryDocValues values = context.reader().getBinaryDocValues(fieldName); if (values == null) { return null;
@Override public BinaryDocValues getBinaryDocValues(String field) throws IOException { ensureOpen(); return in.getBinaryDocValues(field); }
@Override public BinaryDocValues getBinaryDocValues(String field) throws IOException { BinaryDocValues oldDocValues = in.getBinaryDocValues(field); if (oldDocValues == null) { return null; } else { return new SortingBinaryDocValues(oldDocValues, docMap); } }
@Override public BinaryDocValues getBinaryDocValues(String field) throws IOException { if (facetFields.contains(field)) { final OrdinalsReader ordsReader = getOrdinalsReader(field); return new OrdinalMappingBinaryDocValues(ordsReader.getReader(in.getContext()), in.getBinaryDocValues(field)); } else { return in.getBinaryDocValues(field); } }
@Override public void doSetNextReader(LeafReaderContext context) throws IOException { this.dataValues.hash = context.reader().getBinaryDocValues(Monitor.FIELDS.hash); this.dataValues.id = context.reader().getSortedDocValues(Monitor.FIELDS.id); this.dataValues.mq = context.reader().getBinaryDocValues(Monitor.FIELDS.mq); }
@Override public BinaryDocValues getBinaryDocValues(String field) throws IOException { Type v = getType(field); if (v == Type.BINARY) { return FieldCache.DEFAULT.getTerms(in, field, true); } else { return in.getBinaryDocValues(field); } }
BytesRef getBinaryDocValues(final int docId, final String field) throws IOException { final int pos = getLeafReader(docId); if (pos == NOT_FOUND) return BytesRefUtils.EMPTY; final BinaryDocValues docValues = leafReaders[pos].getBinaryDocValues(field); if (docValues == null) return BytesRefUtils.EMPTY; return docValues.get(docId - docBases[pos]); }
@Override public BinaryDocValues getBinaryDocValues(String field) throws IOException { if (facetFields.contains(field)) { final OrdinalsReader ordsReader = getOrdinalsReader(field); return new OrdinalMappingBinaryDocValues(ordsReader.getReader(in.getContext())); } else { return in.getBinaryDocValues(field); } }