Phonetic Research for Telephone Directory

Asked

Viewed 410 times

4

I’m having a problem searching for phrases, I have a search field and I’m using the LIKE operator to do this, but it’s not serving me correctly, I tried now using SOUNDEX, but it only returns a word with the same phonetics as the other word, What I need is to find a word between a sentence. Follow my SQL code.

  $sql = "SELECT * FROM tabela WHERE LOWER('') LIKE LOWER('%$valor%')";
  • 2

    Related: http://answall.com/q/1828/101 the solution you want is not even simple and using resources prepared for other languages will also hinder more than help. Here, for example, we need to make the word "more" be interpreted as "but" because many people do not know the different and type wrong :P

1 answer

2


From what I understand you don’t really want a phonetic research, you just want an alternative to LIKE (that is not performatic, especially when we seek a word in the middle of the text).

This alternative would be the ability to Full Text Search

To create an index in the columns:

ALTER TABLE tabela ADD FULLTEXT(meu_campo);

For the search:

SELECT * FROM tabela 
WHERE MATCH (meu_campo)
AGAINST ('valor' IN NATURAL LANGUAGE MODE);
  • Reading the @bigown commentary it seems to me that you want an algorithm with search for similarity within sentences (if that’s the intention my answer is out of context). I await your enlightenment.

  • That’s right my dear, my problem is looking for similarity within a sentence.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.