You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Sagar Agrawal <sn...@gmail.com> on 2010/05/31 12:14:38 UTC

searching keys of the form substring*

Hi folks,

I want to  fetch all those records from my column family such that the key
starts with a specified string...

e.g.  Suppose I have a CF keyed on full names(first name + last name) of
persons...
now I want to fetch all those records whose first name is 'John'

Right now, I am using OPP and KeyRange in the following way:

 KeyRange keyRange = new KeyRange();
            keyRange.setStart_key("John");
            keyRange.setEnd_key("Joho");

but this is sort of hard coding.... can anyone suggest a better way to
achieve this?

I would be really grateful... thank you.

Re: searching keys of the form substring*

Posted by vd <vi...@gmail.com>.
As I told you on IRC channel ........dont go for shortcuts ...learn java
first.
_______________________________________
Vineet Daniel
_______________________________________

Let your email find you....


On Tue, Jun 1, 2010 at 11:47 AM, Sagar Agrawal <sn...@gmail.com> wrote:

> Thanks Vineet for replying, but I am not able to understand how can we use
> variable substitution in it.
>
>
>
>
> On Mon, May 31, 2010 at 4:42 PM, vd <vi...@gmail.com> wrote:
>
>> Hi Sagar
>>
>> You can use variable substitution.
>> _______________________________________
>> Vineet Daniel
>> _______________________________________
>>
>> Let your email find you....
>>
>>
>>
>> On Mon, May 31, 2010 at 3:44 PM, Sagar Agrawal <sn...@gmail.com> wrote:
>>
>>> Hi folks,
>>>
>>> I want to  fetch all those records from my column family such that the
>>> key starts with a specified string...
>>>
>>> e.g.  Suppose I have a CF keyed on full names(first name + last name) of
>>> persons...
>>> now I want to fetch all those records whose first name is 'John'
>>>
>>> Right now, I am using OPP and KeyRange in the following way:
>>>
>>>  KeyRange keyRange = new KeyRange();
>>>             keyRange.setStart_key("John");
>>>             keyRange.setEnd_key("Joho");
>>>
>>> but this is sort of hard coding.... can anyone suggest a better way to
>>> achieve this?
>>>
>>> I would be really grateful... thank you.
>>>
>>>
>>>
>>
>

Re: searching keys of the form substring*

Posted by Sagar Agrawal <sn...@gmail.com>.
Thanks Vineet for replying, but I am not able to understand how can we use
variable substitution in it.



On Mon, May 31, 2010 at 4:42 PM, vd <vi...@gmail.com> wrote:

> Hi Sagar
>
> You can use variable substitution.
> _______________________________________
> Vineet Daniel
> _______________________________________
>
> Let your email find you....
>
>
>
> On Mon, May 31, 2010 at 3:44 PM, Sagar Agrawal <sn...@gmail.com> wrote:
>
>> Hi folks,
>>
>> I want to  fetch all those records from my column family such that the key
>> starts with a specified string...
>>
>> e.g.  Suppose I have a CF keyed on full names(first name + last name) of
>> persons...
>> now I want to fetch all those records whose first name is 'John'
>>
>> Right now, I am using OPP and KeyRange in the following way:
>>
>>  KeyRange keyRange = new KeyRange();
>>             keyRange.setStart_key("John");
>>             keyRange.setEnd_key("Joho");
>>
>> but this is sort of hard coding.... can anyone suggest a better way to
>> achieve this?
>>
>> I would be really grateful... thank you.
>>
>>
>>
>

Re: searching keys of the form substring*

Posted by vd <vi...@gmail.com>.
Hi Sagar

You can use variable substitution.
_______________________________________
Vineet Daniel
_______________________________________

Let your email find you....


On Mon, May 31, 2010 at 3:44 PM, Sagar Agrawal <sn...@gmail.com> wrote:

> Hi folks,
>
> I want to  fetch all those records from my column family such that the key
> starts with a specified string...
>
> e.g.  Suppose I have a CF keyed on full names(first name + last name) of
> persons...
> now I want to fetch all those records whose first name is 'John'
>
> Right now, I am using OPP and KeyRange in the following way:
>
>  KeyRange keyRange = new KeyRange();
>             keyRange.setStart_key("John");
>             keyRange.setEnd_key("Joho");
>
> but this is sort of hard coding.... can anyone suggest a better way to
> achieve this?
>
> I would be really grateful... thank you.
>
>
>