List of usage examples for org.apache.lucene.document Document getBinaryValues
public final BytesRef[] getBinaryValues(String name)
From source file:com.google.gerrit.lucene.LuceneChangeIndex.java
License:Apache License
private static <T> List<T> decodeProtos(Document doc, String fieldName, ProtobufCodec<T> codec) { BytesRef[] bytesRefs = doc.getBinaryValues(fieldName); if (bytesRefs.length == 0) { return Collections.emptyList(); }//from w w w. j a v a 2s. c o m List<T> result = new ArrayList<>(bytesRefs.length); for (BytesRef r : bytesRefs) { result.add(codec.decode(r.bytes, r.offset, r.length)); } return result; }