Jump to content

Word Search


The Little Guy

Recommended Posts

Each member is allowed to post up to 40 words that describes them. I have a file that you pass a list of comma separated values, such as:

cool,cat,dog

 

this filters all the members that have those 3 words in their words list. The query I have to get those members works, but I think it is really slow since it uses having. Any thoughts on how to speed it up?

 

select *, count(*) c from words w left join users u on(w.owner = u.id) where w.word in('$filter') and u.id != $_id group by u.id having c >= $nwords limit 5

 

using the above words the query would look like this:

select *, count(*) c from words w left join users u on(w.owner = u.id) where w.word in('cool','cat','dog') and u.id != 4 group by u.id having c >= 3 limit 5

Link to comment
https://forums.phpfreaks.com/topic/234487-word-search/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.