Java Code Examples for org.apache.lucene.index.BinaryDocValues#binaryValue()
The following examples show how to use
org.apache.lucene.index.BinaryDocValues#binaryValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SerializedDVStrategy.java From lucene-solr with Apache License 2.0 | 6 votes |
@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); } }; }
Example 2
Source File: JoinDocFreqValueSource.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOException { final BinaryDocValues terms = DocValues.getBinary(readerContext.reader(), field); final IndexReader top = ReaderUtil.getTopLevelContext(readerContext).reader(); Terms t = MultiTerms.getTerms(top, qfield); final TermsEnum termsEnum = t == null ? TermsEnum.EMPTY : t.iterator(); return new IntDocValues(this) { int lastDocID = -1; @Override public int intVal(int doc) throws IOException { if (doc < lastDocID) { throw new IllegalArgumentException("docs were sent out-of-order: lastDocID=" + lastDocID + " vs docID=" + doc); } lastDocID = doc; int curDocID = terms.docID(); if (doc > curDocID) { curDocID = terms.advance(doc); } if (doc == curDocID) { BytesRef term = terms.binaryValue(); if (termsEnum.seekExact(term)) { return termsEnum.docFreq(); } } return 0; } }; }
Example 3
Source File: LireValueSource.java From liresolr with GNU General Public License v2.0 | 5 votes |
private BytesRef getBytesRef(BinaryDocValues bdv, int docId) throws IOException { if (bdv != null && bdv.advance(docId) == docId) { // if (bdv != null && bdv.docID() < docId && bdv.advance(docId) == docId) { // if (bdv != null && bdv.advanceExact(docId)) { return bdv.binaryValue(); } return new BytesRef(BytesRef.EMPTY_BYTES); }
Example 4
Source File: LireRequestHandler.java From liresolr with GNU General Public License v2.0 | 5 votes |
private BytesRef getBytesRef(BinaryDocValues bdv, int docId) throws IOException { if (bdv != null && bdv.advance(docId) == docId) { // if (bdv != null && bdv.docID() < docId && bdv.advance(docId) == docId) { // if (bdv != null && bdv.advanceExact(docId)) { return bdv.binaryValue(); } return new BytesRef(BytesRef.EMPTY_BYTES); }