i am trying to use cassandra via phpcassa and below is the code:
$pool = new ConnectionPool($KS, array('127.0.0.1:9160'));
$users=new ColumnFamily($pool,$CF);
$users->insert_format = ColumnFamily::ARRAY_FORMAT;
$users->return_format = ColumnFamily::ARRAY_FORMAT;
$email='[email protected]';
$input=array('col1' => 'val1',
'col2' => 'val2',
'col3' => 'val3','col4'=>'ladhania');
$users->insert($email,$input);
$row=$users->get($email);
var_dump($row);
echo $users->get_count('$email');
but the output is :
array(2) { [0]=> array(2) { [0]=> string(1) "l" [1]=> string(1) "a" } [1]=> array(2) { [0]=> string(1) "v" [1]=> string(1) "a" } }
0
i would like to know
thanks in advance
Since you're specifying ARRAY_FORMAT as the input format, it's expecting the columns to be like this:
$input = array(array('col1', 'val1'),
array('col2', 'val2'),
array('col3', 'val3'),
array('col4', 'ladhania'));
The alternate formats example may also be useful.
Is there a php client to search cassandra using solr?
DataStax Enterprise has integrated Solr support, which you can query through either the Solr API, CQL (in recent versions), or the Thrift API (e.g. phpcassa).