/** Retrieves the BinaryDocValues for the field in this segment */ protected BinaryDocValues getBinaryDocValues(LeafReaderContext context, String field) throws IOException { return DocValues.getBinary(context.reader(), field); }
@Override public SortedBinaryDocValues getBytesValues() { try { final BinaryDocValues values = DocValues.getBinary(reader, field); return FieldData.singleton(values); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
@Override public BytesBinaryDVAtomicFieldData load(LeafReaderContext context) { try { return new BytesBinaryDVAtomicFieldData(DocValues.getBinary(context.reader(), fieldName)); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
@Override public BinaryDocValues apply(LeafReader ctx) throws IOException { return DocValues.getBinary(ctx, field); } };
@Override public SortedBinaryDocValues getBytesValues() { try { final BinaryDocValues values = DocValues.getBinary(reader, field); return FieldData.singleton(values); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
@Override public SortedBinaryDocValues getBytesValues() { try { final BinaryDocValues values = DocValues.getBinary(reader, field); return FieldData.singleton(values); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
/** Retrieves the BinaryDocValues for the field in this segment */ protected BinaryDocValues getBinaryDocValues(LeafReaderContext context, String field) throws IOException { return DocValues.getBinary(context.reader(), field); }
/** Retrieves the BinaryDocValues for the field in this segment */ protected BinaryDocValues getBinaryDocValues(LeafReaderContext context, String field) throws IOException { return DocValues.getBinary(context.reader(), field); }
/** Retrieves the BinaryDocValues for the field in this segment */ protected BinaryDocValues getBinaryDocValues(LeafReaderContext context, String field) throws IOException { return DocValues.getBinary(context.reader(), field); }
@Override public ShapeValues getValues(LeafReaderContext readerContext) throws IOException { final BinaryDocValues docValues = DocValues.getBinary(readerContext.reader(), fieldName); return new ShapeValues() { @Override public boolean advanceExact(int doc) throws IOException { return docValues.advanceExact(doc); } @Override public Shape value() throws IOException { BytesRef bytesRef = docValues.binaryValue(); DataInputStream dataInput = new DataInputStream(new ByteArrayInputStream(bytesRef.bytes, bytesRef.offset, bytesRef.length)); return binaryCodec.readShape(dataInput); } }; }
@Override public BytesBinaryDVAtomicFieldData load(LeafReaderContext context) { try { return new BytesBinaryDVAtomicFieldData(DocValues.getBinary(context.reader(), fieldName)); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
@Override public SortedBinaryDocValues getBytesValues() { try { final BinaryDocValues values = DocValues.getBinary(reader, field); final Bits docsWithField = DocValues.getDocsWithField(reader, field); return FieldData.singleton(values, docsWithField); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
@Override public BytesBinaryDVAtomicFieldData load(LeafReaderContext context) { try { return new BytesBinaryDVAtomicFieldData(DocValues.getBinary(context.reader(), fieldName)); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
@Override public BytesBinaryDVAtomicFieldData load(LeafReaderContext context) { try { return new BytesBinaryDVAtomicFieldData(DocValues.getBinary(context.reader(), fieldName)); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
@Override public SortedBinaryDocValues getBytesValues() { try { final BinaryDocValues values = DocValues.getBinary(reader, field); final Bits docsWithField = DocValues.getDocsWithField(reader, field); return FieldData.singleton(values, docsWithField); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
@Override public BytesBinaryDVAtomicFieldData load(LeafReaderContext context) { try { return new BytesBinaryDVAtomicFieldData(DocValues.getBinary(context.reader(), fieldNames.indexName())); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
@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); } }
@Override public AtomicGeoPointFieldData load(LeafReaderContext context) { try { if (indexCreatedBefore2x) { return new GeoPointLegacyDVAtomicFieldData(DocValues.getBinary(context.reader(), fieldNames.indexName())); } return new GeoPointDVAtomicFieldData(DocValues.getSortedNumeric(context.reader(), fieldNames.indexName())); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
@Override public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException { final BinaryDocValues terms = DocValues.getBinary(readerContext.reader(), field); final IndexReader top = ReaderUtil.getTopLevelContext(readerContext).reader(); Terms t = MultiFields.getTerms(top, qfield); final TermsEnum termsEnum = t == null ? TermsEnum.EMPTY : t.iterator(); return new IntDocValues(this) { @Override public int intVal(int doc) { try { final BytesRef term = terms.get(doc); if (termsEnum.seekExact(term)) { return termsEnum.docFreq(); } else { return 0; } } catch (IOException e) { throw new RuntimeException("caught exception in function "+description()+" : doc="+doc, e); } } }; }
@Override public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException { final BinaryDocValues terms = DocValues.getBinary(readerContext.reader(), field); final IndexReader top = ReaderUtil.getTopLevelContext(readerContext).reader(); Terms t = MultiFields.getTerms(top, qfield); final TermsEnum termsEnum = t == null ? TermsEnum.EMPTY : t.iterator(); return new IntDocValues(this) { @Override public int intVal(int doc) { try { final BytesRef term = terms.get(doc); if (termsEnum.seekExact(term)) { return termsEnum.docFreq(); } else { return 0; } } catch (IOException e) { throw new RuntimeException("caught exception in function "+description()+" : doc="+doc, e); } } }; }