I have a field (tags_ids) that contains tags id of products in comma-separated format. To find similar products, I wrote a query like below :
select * , MATCH (tags_ids) AGAINST('1000,1001,1002,1004' IN NATURAL LANGUAGE MODE) as score from product ORDER BY score DESC
And the result :
array (size=7)
0 =>
array (size=2)
'tags_ids' => string '1000,1001,1002,1004' (length=19)
'score' => float 0.35009866952896
1 =>
array (size=2)
'tags_ids' => string '1004' (length=4)
'score' => float 0.15835624933243
2 =>
array (size=2)
'tags_ids' => string '1002' (length=4)
'score' => float 0.15835624933243
3 =>
array (size=2)
'tags_ids' => string '1000,1001' (length=9)
'score' => float 0.033386167138815
4 =>
array (size=2)
'tags_ids' => string '1001,1006' (length=9)
'score' => float 0.023994617164135
5 =>
array (size=2)
'tags_ids' => string '1000' (length=4)
'score' => float 0.0093915509060025
6 =>
array (size=2)
'tags_ids' => string '1003,1000' (length=9)
'score' => float 0.0093915509060025
But I want element number 3 ('1000,1001') be in second priority (rather than '1004'). The string '1000,1001' isn't more like the '1000,1001,1002,1004' than '1002' !?
There is mistake in my query or match-against is not suitable for such application? Is there a better solution?
Note : I replaced comma with space but result was exactly the same