cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tyler Hobbs <ty...@datastax.com>
Subject Re: Problem with PHPCassa accessing Indexes
Date Tue, 28 Jun 2011 22:00:10 GMT
What does the ouput of 'describe keyspace <keyspaces>' show for the
keyspace the CF is in?

On Tue, Jun 28, 2011 at 2:35 PM, Jean-Nicolas Boulay Desjardins
<jnbdzjnbdz@gmail.com> wrote:
> Actually I am not getting any results from: get_indexed_slices()
>
> It seems my code dies at: $rows =
> $column_family->get_indexed_slices($index_clause);
>
> Because everything after that is echo is not shown on the page.
>
> Plus I don't get any errors.
>
> Any ideas?
>
> On Tue, Jun 28, 2011 at 3:23 PM, Tyler Hobbs <tyler@datastax.com> wrote:
>> The result of get_indexed_slices() is an Iterator object, not an
>> array.  It doesn't look like you're treating it accordingly.
>>
>> See the bottom of this section for an example:
>> http://thobbs.github.com/phpcassa/tutorial.html#indexes
>>
>> On Tue, Jun 28, 2011 at 2:06 PM, Jean-Nicolas Boulay Desjardins
>> <jnbdzjnbdz@gmail.com> wrote:
>>> Hi,
>>>
>>> I am having problem accessing data via an index with PHPCassa. I have
>>> var_dump() the results:
>>>
>>> array(6) { ["birthdate"]=> int(3546927995491989807) ["email"]=>
>>> string(20) "jnbdzjnbdz@gmail.com" ["firstname"]=> string(12)
>>> "Jean-Nicolas" ["lastname"]=> string(17) "Boulay Desjardins"
>>> ["password"]=> string(8) "password" ["username"]=> string(5) "jnbdz" }
>>>
>>> object(cassandra_IndexExpression)#76 (3) { ["column_name"]=> string(5)
>>> "email" ["op"]=> int(0) ["value"]=> string(20) "jnbdzjnbdz@gmail.com"
>>> }
>>>
>>> object(cassandra_IndexClause)#77 (3) { ["expressions"]=> array(1) {
>>> [0]=> object(cassandra_IndexExpression)#76 (3) { ["column_name"]=>
>>> string(5) "email" ["op"]=> int(0) ["value"]=> string(20)
>>> "jnbdzjnbdz@gmail.com" } } ["start_key"]=> string(0) "" ["count"]=>
>>> int(100) }
>>>
>>> Here is the code:
>>>
>>> $columnFamily = CASSANDRA::selectColumnFamily('Users');
>>>
>>>                 $this->selectUser = $columnFamily->get('jnbdz');
>>>
>>>                 var_dump($this->selectUser);
>>>
>>>                 echo '<br/>';
>>>                 echo '<br/>';
>>>
>>>                 $index_exp =
>>> CassandraUtil::create_index_expression('email',
>>> 'jnbdzjnbdz@gmail.com');
>>> var_dump($index_exp);
>>>                 $index_clause =
>>> CassandraUtil::create_index_clause(array($index_exp));
>>> echo '<br/>';
>>> echo '<br/>';
>>> var_dump($index_clause);
>>>                 $rows = $column_family->get_indexed_slices($index_clause);
>>> echo '<br/>';
>>> echo '<br/>';
>>> var_dump($rows);
>>>                 var_dump($row);
>>>
>>> Thanks in advance for any help
>>>
>>
>>
>>
>> --
>> Tyler Hobbs
>> Software Engineer, DataStax
>> Maintainer of the pycassa Cassandra Python client library
>>
>
>
>
> --
> Name / Nom: Boulay Desjardins, Jean-Nicolas
> Website / Site Web: www.jeannicolas.com
>



-- 
Tyler Hobbs
Software Engineer, DataStax
Maintainer of the pycassa Cassandra Python client library

Mime
View raw message