MySQL fulltext autocomplete search issues
So I have been struggling with FULLTEXT index searches, had a previous question here which was resolved, but it seems for some searches it works ok, and on others it doesn't
As before, looking for games in a games table, has about 25k rows, with the FULLTEXT index on g_name. I also need it to work using autocomplete as well, eg with incomplete search terms
With the search term, I explode it and then loop each iteration, appending a * onto the end eg 'grand* theft* auto* v*'
So here are some sample searches. It outputs the query at the top:
BOOLEAN MODE off, results ok
(link dead)
BOOLEAN MODE on, results not coming back as expected
(link dead)
BOOLEAN MODE off, results ok, although unsure how 'Tenchu: Shadow Assassins' is scoring more relevant to other 'assassins creed' games?
(link dead)
BOOLEAN MODE on, results not showing 'assassins creed iii'
(link dead)
Autocomplete texting partial word, BOOLEAN MODE off, NO RESULTS?!
(link dead)
Autocomplete texting partial word, BOOLEAN MODE off, ok results
(link dead)
Not sure why turning boolean mode on / off is producing such strange results. Its like I need it on for some searches and off for others, but I need a single search query. The scores seem to be just BS figures pulled from nowhere.
Also if I start adding '+' into the mix for non optional words it produces even stranger results. The whole reason I added fulltext was to make things more flexible, and return more useful results, but seems to have made things worse.
So my question , how do I make it return useful results every time, regardless of the nuances of that particular search term / game, and if its a partial search, or the full term. Ideally similar to how http://www.metacritic.com/ do it (top right search box)
One course project I taught covers this topic: https://grape.ics.uci.edu/wiki/public/wiki/cs122b-2012-spring-project4#Requirement2 Solution: https://grape.ics.uci.edu/wiki/public/wiki/cs122b-2012-spring-mysql-fulltext Pay attention to the following examples:
Prefix Search: SELECT entryID FROM ft WHERE MATCH (entry) AGAINST ('grad*' IN BOOLEAN MODE);
Boolean Searches: SELECT entryID FROM ft WHERE MATCH (entry) AGAINST ('+graduate -michigan' IN BOOLEAN MODE);
This approach works, but is slow and has poor ranking.
链接地址: http://www.djcxy.com/p/75320.html上一篇: mysql fulltext用asterix进行布尔搜索
下一篇: MySQL全文自动完成搜索问题