List of usage examples for org.apache.cassandra.db.rows Cell column
public final ColumnMetadata column()
From source file:com.stratio.cassandra.lucene.column.ColumnsMapper.java
License:Apache License
private void addColumns(Columns columns, Cell cell) { if (cell != null) { ColumnDefinition columnDefinition = cell.column(); String name = columnDefinition.name.toString(); AbstractType<?> type = cell.column().type; ByteBuffer value = cell.value(); ColumnBuilder builder = Column.builder(name); if (type.isCollection() && !type.isFrozenCollection()) { CollectionType<?> collectionType = (CollectionType<?>) type; switch (collectionType.kind) { case SET: { type = collectionType.nameComparator(); value = cell.path().get(0); addColumns(columns, builder, type, value); break; }/*from w w w . j av a 2s .c om*/ case LIST: { type = collectionType.valueComparator(); addColumns(columns, builder, type, value); break; } case MAP: { type = collectionType.valueComparator(); ByteBuffer keyValue = cell.path().get(0); AbstractType<?> keyType = collectionType.nameComparator(); String nameSuffix = keyType.compose(keyValue).toString(); addColumns(columns, builder.withMapName(nameSuffix), type, value); break; } default: { throw new IndexException("Unknown collection type %s", collectionType.kind); } } } else { addColumns(columns, Column.builder(name), type, value); } } }
From source file:io.puntanegra.fhir.index.FhirIndexIndexer.java
License:Apache License
@SuppressWarnings("unused") private boolean insertInIndex(final String indexResourceType, Row row) { // only index in the correct lucene index. // this code checks if the resourceType is the same as the index. // TODO: externalizar resource_type for (Cell cell : row.cells()) { String columnname = cell.column().name.toString(); if ("resource_type".equals(columnname)) { String resourceType = ByteBufferUtils.toString(cell.value(), UTF8Type.instance); if (indexResourceType.equals(resourceType)) { return true; }//from ww w . ja v a2s .c om return false; } } return false; }