best search method

D

Dave Lilley

I've got a small contact mysql database and need to do a soundex type of
search.
What I'd like to get some feed back on this idea...

you enter a name + surname, I search the table.
Result is...
1. a match is found, details displayed - all is good.
2. multiple matches - display the list as I'd do for point 3 below.
3. No match so go to a SQL statement on the 1st letter of the 1st word
display a list of names returned and say 1st 20 words of the details.

Note details is a text blob field and entry is a 40 vchar string field.

list would look something like this....

Bob surname 22 anyplace street
Bob no surname 18 here Rd
Ben pope 55 here too
Benny hill 23 there place
Blenda ball 15 Hope rd
Brent oil Corporate man
Brent oil family friend

you're thoughts be great and issues you can see or have experienced with
in the past be great.

I don't envision it getting too complex but the list of names may do
over time.

thanks for reading this - hope you can guide me so a good solution.

dave.
 
S

Shadowfirebird

Excerpts from Dave Lilley's message of Mon Mar 14 08:58:23 +0000 2011:
I've got a small contact mysql database and need to do a soundex type of
search.
What I'd like to get some feed back on this idea...

Never done this in Ruby so there may be a better way. But why not actually use Soundex?

Go to http://en.wikipedia.org/wiki/Soundex#Rules for the encoding rules. It's not too hard.

To speed things up, store the soundex version of the name on the database (or a different database if it's not yours. Doesn't have to have the same table, just have enough fields to help you find the unique record in that table.)

So all you have to do when you have a name to match is convert that name to soundex, then compare that with the soundex values on the database.

Hope that helps...
 
S

Shadowfirebird

Never done this in Ruby so there may be a better way. But why not actually use Soundex?

Replying to myself and therefore proving I leap before I look.

Implementations of Soundex, Metaphone and Double-metaphone in Ruby here: https://github.com/threedaymonk/text#readme

Looks like you just 'gem install text', or similar.
 
D

Dave Lilley

Shadowfirebird wrote in post #987287:
use
Soundex?

Replying to myself and therefore proving I leap before I look.

Implementations of Soundex, Metaphone and Double-metaphone in Ruby here:
https://github.com/threedaymonk/text#readme

Looks like you just 'gem install text', or similar.

Thanks shadowfirebird,

But I need to be able to have the generated soundex to be the same
regardless of the programming language used (this issue has just been
put upon me - Grrr) I know for a fact that PHP will be used so think the
best approach would be to use the built in MYSQL soundex.

I'm using sequel for the DB access so anyone know of a way to do this
from within that gem?

I'd like to do something like this...
(lost the url but the sample code was this...)

select soundex(hello)

result was I think H400 or something like that.

dave.
 
B

brabuhr

... best approach would be to use the built in MYSQL soundex.

I'd like to do something like this...
(lost the url but the sample code was this...)

select soundex(hello)

result was I think H400 or something like that.

Sounds reasonable to let MySQL handle it:
I'm using sequel for the DB access so anyone know of a way to do this
from within that gem?

What have you tried that did not work?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top