mysql - Looking for a better solution - long list of AND operator with a type String comparision -


i have search function search keywords in large mysql table, since need filter out bad words, have following type of , comparison in mysql, long list of banned words (over 500+) , due slow,

select * keywords 1       , keyword not '%love%'     , keyword not '%hope%'     , keyword not '%caring%'     , keyword not '%x%'     , keyword not '%happiness%'     , keyword not '%forgiveness%'     , keyword not '%good%'     , keyword not '%great%'     , keyword not '%positive%'     , keyword not '%sharing%'     , keyword not '%awesome%'     , keyword not '%fantastic%'  

any other better way of doing ?

using like pattern-matching has terrible performance, because there's no way use index it. using regular expressions @fuzic suggests worse.

you need use fulltext indexing solution if want performance.

i cover , compare several solutions in presentation, full text search throwdown.


the brief answer: use sphinx search.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -