views:

132

answers:

2

I am looking on running a search on my database at set intervals for a list of words I consider offensive (because I am an authoritarian dictator and I hate free speech - I rule with an Iron fist).

How would I most efficiently search my database for a list of keywords? The two columns I intend to search are indexed as Fulltext.

If anyone knows of a list of offensive words that would be useful too.

A note to those who ridicule my attempts at censorship

I have will have two systems in place. The first is a report function which is checked daily by admins. The second tool to combat the dissenters is this one. All it needs to be is a word search so that the admin may check through and descide if the content is offensive or not.

+2  A: 

Mysql won't give you the tools for an acurate search, take this sample, if you have among your words:

freedom

Since you are a dictator you don't want it, it should appear, but clever users will put fr33dom, which is the same, now you have 3 ways to dot this:

  1. You place in your list one word and most derivations you can imagine
  2. You make a search with a LIKE in your MySql query, but it should be sloow when you hit the thousands, even with fulltext indexes
  3. You Index your content using Lucene

I would go for the third, since Lucene is the best choice for performing searches, and since you are looking for words I can imagine that you are dealing with text, so this might help more than you think. Lucene can help you searching words similar to freedom, but not it, there you shouldn't miss much!! And your rule is guarrantied!

There are extensions for Lucene using Zend Framework, you can find them easily in Google.

Best of luck in your dictatorial efforst!

David Conde
Lucene looks tough... I should have noted that I am looking for a quick solution... intended as a temporary solution for the launch of my application. I think I favour the first solution. The second will likely hit a lot of false positives too.
Starlin
Also note you will be handsomely rewarded for you efforts. I never forget those who have supported me.
Starlin
Thank you for your grace, my lord! hahaha. I hope I can help!
David Conde
+1  A: 

here's your staring list! http://onlineslangdictionary.com/lists/most-vulgar-words/ Check site for more

idea: DB their list, then screen against your DB. Or, DB their list, create all as key words, blocking entry. Then, use SQL wild card within words to check for: freedom or Fr**dom,

But problems tech1 derivations are infinite.

If you can at least block Cl**eland St**mer you should be in the clear.
ChaosPandion
Most of those seem to be phrases rather than words, and rather contrived phrases at that.
Hammerite