List of usage examples for org.apache.lucene.util BytesRefHash BytesRefHash
public BytesRefHash(ByteBlockPool pool)
From source file:solutions.siren.join.action.terms.collector.BytesRefTermsSet.java
License:Open Source License
public BytesRefTermsSet(final CircuitBreaker breaker) { super(breaker); this.bytesUsed = Counter.newCounter(); this.pool = new ByteBlockPool(new ByteBlockPool.DirectTrackingAllocator(bytesUsed)); this.set = new BytesRefHash(pool); }
From source file:solutions.siren.join.action.terms.collector.BytesRefTermsSet.java
License:Open Source License
@Override public void readFrom(StreamInput in) throws IOException { this.setIsPruned(in.readBoolean()); int size = in.readInt(); bytesUsed = Counter.newCounter();/* w ww.j a v a 2 s. co m*/ pool = new ByteBlockPool(new ByteBlockPool.DirectTrackingAllocator(bytesUsed)); set = new BytesRefHash(pool); for (long i = 0; i < size; i++) { set.add(in.readBytesRef()); } }
From source file:solutions.siren.join.action.terms.collector.BytesRefTermsSet.java
License:Open Source License
private void readFromBytes(BytesRef bytes) { // Read pruned flag this.setIsPruned(bytes.bytes[bytes.offset++] == 1 ? true : false); // Read size fo the set int size = Bytes.readInt(bytes); // Read terms bytesUsed = Counter.newCounter();/*from www . j a v a2s. c o m*/ pool = new ByteBlockPool(new ByteBlockPool.DirectTrackingAllocator(bytesUsed)); set = new BytesRefHash(pool); BytesRef reusable = new BytesRef(); for (int i = 0; i < size; i++) { Bytes.readBytesRef(bytes, reusable); set.add(reusable); } }