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
- why isnt it storing all the 4 columns
- why the stored columns have value of only one character
- Is there a php client to search cassandra using solr
thanks in advance
Since you're specifying ARRAY_FORMAT as the input format, it's expecting the columns to be like this:
The alternate formats example may also be useful.
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).