String key = segment + "_" + add.text();
if (!redis.exists(key)) {
// New key - just add it with the current bitset
//int[] docset = new int[docs.cardinality()];
ByteBuffer bytes = ByteBuffer.allocate(docs.cardinality() * 4);
IntBuffer docset = bytes.asIntBuffer();
for (int i = docs.nextSetBit(0), j = 0; i >= 0; i = docs.nextSetBit(i + 1), j++) {
docset.put(j, i);
}
redis.set(key, bytes.array());
}
else {
byte[] orig = redis.get(key);