Java Code Examples for org.apache.lucene.util.BytesRef#EMPTY_BYTES
The following examples show how to use
org.apache.lucene.util.BytesRef#EMPTY_BYTES .
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: PagedBytesReference.java From Elasticsearch with Apache License 2.0 | 6 votes |
@Override public byte[] toBytes() { if (length == 0) { return BytesRef.EMPTY_BYTES; } BytesRef ref = new BytesRef(); bytearray.get(offset, length, ref); // undo the single-page optimization by ByteArray.get(), otherwise // a materialized stream will contain traling garbage/zeros byte[] result = ref.bytes; if (result.length != length || ref.offset != 0) { result = Arrays.copyOfRange(result, ref.offset, ref.offset + length); } return result; }
Example 2
Source File: PagedBytesReference.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public byte[] array() { if (hasArray()) { if (length == 0) { return BytesRef.EMPTY_BYTES; } BytesRef ref = new BytesRef(); bytearray.get(offset, length, ref); return ref.bytes; } throw new IllegalStateException("array not available"); }
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: RandomAccessBinaryDocValues.java From liresolr with GNU General Public License v2.0 | 5 votes |
@Override public BytesRef binaryValue() throws IOException { if (docValues == null) { return new BytesRef(BytesRef.EMPTY_BYTES); } return docValues.binaryValue(); }
Example 5
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); }
Example 6
Source File: GeohashPrefixTree.java From lucene-solr with Apache License 2.0 | 4 votes |
@Override public Cell getWorldCell() { return new GhCell(BytesRef.EMPTY_BYTES, 0, 0); }
Example 7
Source File: QuadPrefixTree.java From lucene-solr with Apache License 2.0 | 4 votes |
@Override public Cell getWorldCell() { return new QuadCell(BytesRef.EMPTY_BYTES, 0, 0); }
Example 8
Source File: PHPSerializedResponseWriter.java From lucene-solr with Apache License 2.0 | 4 votes |
public PHPSerializedWriter(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) { super(writer, req, rsp); this.utf8 = BytesRef.EMPTY_BYTES; // never indent serialized PHP data doIndent = false; }