Msg#: 4556910 posted 9:18 am on Mar 21, 2013 (gmt 0)
create the full text index using phpMyAdmin or however you usually admin your database ... or run a query like: ALTER TABLE myTable ADD FULLTEXT(title, description); (you would need sufficient privileges to do this)
and then your query would be something like this:
SELECT * FROM myTable WHERE MATCH(title,description) AGAINST('+keyword1 +keyword2' IN BOOLEAN MODE)
that's how i do it anyway.
you need to write some kind of function in order to add the '+' sign before each word.
note by default i think the index only indexes words of 3 letters or more, you can change this in the MySQL configuration file if you want to.
Msg#: 4556910 posted 8:44 pm on Mar 21, 2013 (gmt 0)
Oh wow, that is so much easier than I had envisioned. Thanks so much. So I would create a variable for the search keywords, then replace ' ' with +, and then add it in there. I don't even need to create an array.
What about ranking, how can I sort rows where the keyword is in the title above keyword in the description?