I’m building a web crawler which collects crawled results into MySQL table.
There are Five Main Columns: URL, TITLE, DESCRIPTION, KEYWORDS, BODY
.
Currently I’m using FULLTEXT
search function of MySQL as follows:
SELECT URL,title, description, MATCH (description, keywords, title, URL) AGAINST ('$keyword' in boolean mode)
AS score FROM record
WHERE MATCH (description, keywords, title, URL) AGAINST ('$keyword' in boolean mode) order by score desc;";
But it is not giving me good results. Consider the following image.
Here, the facebook is at 23rd position on searching "Facebook"
.(?)
Can i prioritize the search based upon the coloumn name? For example, I want the query to give maximum priority to URL
, then description
, then title
, keywords
.. and finally body
.
Any suggestions ?
2
Answers
Look at something like SoundEx:
See: http://www.madirish.net/?article=85
Additionally could you not considering doing the weighting yourself: (I don’t have MySQL local, so sorry for the semi-pseudocode)
Just use LIKE operator for URL matching. See above code. Thank U!