I have a basic query below where it searches a question from the database when the user types in a question in a textbox:
$questionquery = "SELECT QuestionContent FROM Question
WHERE(QuestionContent = '".mysql_real_escape_string($questioncontent)."');
Now the above query isn’t really practical as that to find a question, the user has to type in the whole question correctly in order to find the question.
Now I don’t want to do a keyword search by using LIKE to find word in a question from the database. Instead what I want to do is to be able to use the query to perform a semantic search so that it is able to find the meaning a phrase entered in the textbox.
Does anybody know if this is possible to perform in the query and if so does anyone know how this can be achieved?
Thanks
Natural Language Full-Text Searches support in MySQL might offer some help. But you need to have the columns against which you want to perform the search indexed as FULLTEXT, and your database engine must be MyISAM.
You could then perform natural language searches against the column with a query like:
Consult the MySQL documentation on Natural Language Full-Text Searches for more information.