1

I have data in MySQL table as below:

data_id     search_content
1           AA-6310|Taxable Goods|Double Key Turner
2           AA6310|Taxable Goods|Handi - Plug
3           AA 6310|Taxable Goods|Plug Pull Self Adhesive
4           AA4654|Taxable Goods|Tights Aid
5           AA 4600|Taxable Goods|Shoe Horn Plastic
6           M 48647|Taxable Goods|Long 
7           48647-S|Taxable Goods|Long 

But when I am searching 6310 using query then it is not returning any results, whereas 6310 is present in first three rows.

I used following queries:

SELECT * FROM `my_tablename` WHERE MATCH (`data_index`) AGAINST ('6310')

SELECT * FROM `my_tablename` WHERE MATCH (`data_index`) AGAINST ('6310' WITH QUERY EXPANSION)

Also the same is happening with the hyphen characters as well, when I am searching 48647-S then also it is not returning any results.

I tried to search in Boolean Mode as well, but it is not working.

What could the reason for this not returning any results, and how I can fix this?

halfer
  • 19,824
  • 17
  • 99
  • 186
djmzfKnm
  • 26,679
  • 70
  • 166
  • 227
  • Have you put a FULLTEXT index on search_content? https://dev.mysql.com/doc/refman/5.6/en/innodb-fulltext-index.html https://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html – Jacob Mulquin Jun 17 '15 at 12:53
  • @mulquin yes FULLTEXT index is set on `search_content` column in table. – djmzfKnm Jun 17 '15 at 12:54
  • See this re. searching for hyphens : http://stackoverflow.com/questions/5192499/how-to-allow-fulltext-searching-with-hyphens-in-the-search-query – PaulF Jun 17 '15 at 13:05
  • Please share your mysql version and table engine. – Zafar Malik Jun 17 '15 at 13:15
  • Hi @ZafarMalik MySQL version is 5.1.73-1 and table engine is MyISAM.. – djmzfKnm Jun 18 '15 at 09:02
  • may you show your "show create table mytable" output...and ft_min_word_len & ft_max_word_len values by show variables like '%ft_%' – Zafar Malik Jun 18 '15 at 09:18

0 Answers0