Best search method

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.

Excerpts from Dave L.'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 Soundex - Wikipedia 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…

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:

Looks like you just ‘gem install text’, or similar.

Shadowfirebird wrote in post #987287:

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:
GitHub - threedaymonk/text: Collection of text algorithms. gem install text

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.

On Sat, Mar 19, 2011 at 11:09 PM, Dave L. [email protected] wrote:

… 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?

On Mon, Mar 21, 2011 at 3:52 PM, [email protected] wrote:

On Sat, Mar 19, 2011 at 11:09 PM, Dave L. [email protected] wrote:

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

select soundex(hello)

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?

Ah, when I sat down to take a look into this, I saw your thread on the
sequel group:
http://groups.google.com/group/sequel-talk/browse_thread/thread/0af3cb3a5fa14d04/da704211e07bf70e

:slight_smile: