PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
What I basically need is a good search engine system.
These are the three values stored in my database:
- green plus red socks
- really big socks
- red socks
When the user searches the input 'red and green socks' I want the database items to appear in the order of how many matching keywords they contain:
- green plus red socks = 3 matches
- red socks = 2 matches
- really big socks = 1 match
This is the code that I have at the moment but it doesn't do what I need it to do:
I'm wondering if you could do this on the mysql end using MATCH and Relevance. Taken from mysql Fulltext searching: Second post after documentation...
SELECT MATCH('Content') AGAINST ('keyword1
keyword2') as Relevance FROM table WHERE MATCH
('Content') AGAINST('+keyword1 +keyword2' IN
BOOLEAN MODE) HAVING Relevance > 0.2 ORDER
BY Relevance DESC