I have a search on my website that search names, so I know all of the
values they could enter. How do I do something like google where if I
type jonson it would say “did you mean johnson”?
Any ideas?
Thanks.
I have a search on my website that search names, so I know all of the
values they could enter. How do I do something like google where if I
type jonson it would say “did you mean johnson”?
Any ideas?
Thanks.
On Jun 17, 9:33 pm, Ben J. [email protected]
wrote:
I have a search on my website that search names, so I know all of the
values they could enter. How do I do something like google where if I
type jonson it would say “did you mean johnson”?Any ideas?
Thanks.
–
Posted viahttp://www.ruby-forum.com/.
there’s several ways: Levenshtein distance, soundex, Metaphone and
Phonex algo’s. There’ve been threads on “spelling correction” here
and in rubytalk.
[email protected] wrote:
Posted viahttp://www.ruby-forum.com/.
there’s several ways: Levenshtein distance, soundex, Metaphone and
Phonex algo’s. There’ve been threads on “spelling correction” here
and in rubytalk.
I actually tried soundex, the problem is that I’m dealing with parts of
the string in the database, not the entire string. There is not split()
function for mysql. Example:
A person types “red sox” and my field has “boston red sox”, soundex
would not detect that.
I’m trying to do this all in a query, for performance reasons, but this
seems to be nearly impossible sicnce mysql does not have a split()
function for strings.
Have you looked at SOLR or other full text search plug-ins.
Michael
Quoting Ben J. [email protected]:
I have a search on my website that search names, so I know all of the
values they could enter. How do I do something like google where if I
type jonson it would say “did you mean johnson”?Any ideas?
Thanks.
Pete Norvig explains how he did it:
http://norvig.com/spell-correct.html
–
Pau Garcia i Quiles
http://www.elpauer.org
(Due to the amount of work, I usually need 10 days to answer)
There’s also a plugin for the feature:
http://agilewebdevelopment.com/plugins/acts_as_suggest
–
Benjamin C.
http://www.bencurtis.com/ – blog
http://agilewebdevelopment.com/rails-ecommerce – build e-commerce
sites with Rails
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs