What is an efficient way to check a word in a paragraph against the DB?

MustafaSoft

New Member
I have a table called keywords. It's simple, two columns - id and keyword. This table is always growing, we're always adding additional content to it. Now, we have a user-submitted 2-3 sentence paragraph. We want to check the words, in this paragraph, against all the keywords in the keywords table. What is the most efficient way to do this? My initial logic is below\[code\]// explode $paragraph into $words[]// cycle through $words -- in each loops, SQL statement where $word = keyword// output any matched keywords\[/code\]Would this be the most efficient? Keep in mind, keywords table can be several thousand rows. Should I maybe use a Sphinx search solution?
 
Back
Top