You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Dalia Sobhy <da...@hotmail.com> on 2012/04/02 22:26:31 UTC

Search by name

Helllooo,

I am using hbase thrift for my app. I have made a table for patient which has first a column family called info which contains his/her general info. 

I want to make a method to search for a patient by his name and date of birth. I didn't find any method for search all requires the row key and I instead need to method which returns the row key.

So any ideasss ???

Thx ;)

Re: Search by name

Posted by Marcos Ortiz <ml...@uci.cu>.
HBasene?
https://github.com/akkumar/hbasene

On 04/02/2012 04:46 PM, Bryan Beaudreault wrote:
> I imagine you don't want this search to have to scan the entire patients
> table to find someone by their name, assuming there could be many many
> patients.  It may be a better idea to create a search table.  The search
> table could have search terms in the row key, and the columns could be
> profileIds.  Then your query execution would be:
>
> 1) do a multiGet of the search table, for row keys 'bryan' and '01-01-2012'.
> 2) intersect the returned columns
> 2) do a multiGet using the profileIds from the intersection as the row keys
> for the various gets
>
> If you want to partial match on names you could do a scan from 'bryan' to
> 'bryao' (n+1) and union all of the columns in each returned row before
> intersecting with the date search.
>
> This just requires you to keep the index up to date when users get added,
> deleted, and updated.
>
> On Mon, Apr 2, 2012 at 4:26 PM, Dalia Sobhy<da...@hotmail.com>wrote:
>
>> Helllooo,
>>
>> I am using hbase thrift for my app. I have made a table for patient which
>> has first a column family called info which contains his/her general info.
>>
>> I want to make a method to search for a patient by his name and date of
>> birth. I didn't find any method for search all requires the row key and I
>> instead need to method which returns the row key.
>>
>> So any ideasss ???
>>
>> Thx ;)
>
> 10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS INFORMATICAS...
> CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION
>
> http://www.uci.cu
> http://www.facebook.com/universidad.uci
> http://www.flickr.com/photos/universidad_uci

-- 
Marcos Luis Ortíz Valmaseda (@marcosluis2186)
  Data Engineer at UCI
  http://marcosluis2186.posterous.com



10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION

http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci

Re: Search by name

Posted by Bryan Beaudreault <bb...@hubspot.com>.
You could use a prefix on the rowkey.  I imagine there are multiple
different field types, so just have an enum or something that enumerates
the different field types you have, such as name, date, email, etc.  Each
value would have a 1 char identifier, so then your search table would have
rowkeys like:

n-bryan
d-01-01-2012
etc

It's probably a good idea to choose a delimiter that is unlikely to be part
of the possible value charset though.

On Mon, Apr 2, 2012 at 4:55 PM, Dalia Sobhy <da...@hotmail.com>wrote:

> Thanks Bryan I will try it it sounds good.
>
> But another question how could I make a table with 2 row keys: name, date
> ???
>
>
> Sent from my iPad
>
> On Apr 2, 2012, at 10:47 PM, "Bryan Beaudreault" <bb...@hubspot.com>
> wrote:
>
> > I imagine you don't want this search to have to scan the entire patients
> > table to find someone by their name, assuming there could be many many
> > patients.  It may be a better idea to create a search table.  The search
> > table could have search terms in the row key, and the columns could be
> > profileIds.  Then your query execution would be:
> >
> > 1) do a multiGet of the search table, for row keys 'bryan' and
> '01-01-2012'.
> > 2) intersect the returned columns
> > 2) do a multiGet using the profileIds from the intersection as the row
> keys
> > for the various gets
> >
> > If you want to partial match on names you could do a scan from 'bryan' to
> > 'bryao' (n+1) and union all of the columns in each returned row before
> > intersecting with the date search.
> >
> > This just requires you to keep the index up to date when users get added,
> > deleted, and updated.
> >
> > On Mon, Apr 2, 2012 at 4:26 PM, Dalia Sobhy <dalia.mohsobhy@hotmail.com
> >wrote:
> >
> >> Helllooo,
> >>
> >> I am using hbase thrift for my app. I have made a table for patient
> which
> >> has first a column family called info which contains his/her general
> info.
> >>
> >> I want to make a method to search for a patient by his name and date of
> >> birth. I didn't find any method for search all requires the row key and
> I
> >> instead need to method which returns the row key.
> >>
> >> So any ideasss ???
> >>
> >> Thx ;)
>

Re: Search by name

Posted by Dalia Sobhy <da...@hotmail.com>.
Thanks Bryan I will try it it sounds good.

But another question how could I make a table with 2 row keys: name, date ???


Sent from my iPad

On Apr 2, 2012, at 10:47 PM, "Bryan Beaudreault" <bb...@hubspot.com> wrote:

> I imagine you don't want this search to have to scan the entire patients
> table to find someone by their name, assuming there could be many many
> patients.  It may be a better idea to create a search table.  The search
> table could have search terms in the row key, and the columns could be
> profileIds.  Then your query execution would be:
> 
> 1) do a multiGet of the search table, for row keys 'bryan' and '01-01-2012'.
> 2) intersect the returned columns
> 2) do a multiGet using the profileIds from the intersection as the row keys
> for the various gets
> 
> If you want to partial match on names you could do a scan from 'bryan' to
> 'bryao' (n+1) and union all of the columns in each returned row before
> intersecting with the date search.
> 
> This just requires you to keep the index up to date when users get added,
> deleted, and updated.
> 
> On Mon, Apr 2, 2012 at 4:26 PM, Dalia Sobhy <da...@hotmail.com>wrote:
> 
>> Helllooo,
>> 
>> I am using hbase thrift for my app. I have made a table for patient which
>> has first a column family called info which contains his/her general info.
>> 
>> I want to make a method to search for a patient by his name and date of
>> birth. I didn't find any method for search all requires the row key and I
>> instead need to method which returns the row key.
>> 
>> So any ideasss ???
>> 
>> Thx ;)

Re: Search by name

Posted by Bryan Beaudreault <bb...@hubspot.com>.
I imagine you don't want this search to have to scan the entire patients
table to find someone by their name, assuming there could be many many
patients.  It may be a better idea to create a search table.  The search
table could have search terms in the row key, and the columns could be
profileIds.  Then your query execution would be:

1) do a multiGet of the search table, for row keys 'bryan' and '01-01-2012'.
2) intersect the returned columns
2) do a multiGet using the profileIds from the intersection as the row keys
for the various gets

If you want to partial match on names you could do a scan from 'bryan' to
'bryao' (n+1) and union all of the columns in each returned row before
intersecting with the date search.

This just requires you to keep the index up to date when users get added,
deleted, and updated.

On Mon, Apr 2, 2012 at 4:26 PM, Dalia Sobhy <da...@hotmail.com>wrote:

> Helllooo,
>
> I am using hbase thrift for my app. I have made a table for patient which
> has first a column family called info which contains his/her general info.
>
> I want to make a method to search for a patient by his name and date of
> birth. I didn't find any method for search all requires the row key and I
> instead need to method which returns the row key.
>
> So any ideasss ???
>
> Thx ;)