0

I have simple table but cant get relevance results for some reason.

In my table i have next records

Кухненски шкафове и модули
Офис модули
Модули за спалня
Модулни секции
Модулни кухни
Модулни гардероби

When i execute this query

SELECT DISTINCT
  name,
  MATCH(name) AGAINST('моду*' IN BOOLEAN MODE) AS score
FROM category scs   
WHERE 
  MATCH(name) AGAINST('моду*' IN BOOLEAN MODE)

I expect 1st to return all strings that start with 'моду' like this

Модули за спалня
Модулни секции
Модулни кухни
Модулни гардероби
Офис модули
Кухненски шкафове и модули

but im getting order like this

Кухненски шкафове и модули
Модули за спалня
Офис модули
Модулни секции 
Модулни кухни 
Модулни гардероби

How can i order them 1st to return all string that start with searched phrase ?

SQL FIDDLE

  • The fulltext search does not/cannot rank by word position. You can sort the results (that you find using the fulltext search) afterwards by using e.g. something from [MySQL order by "best match"](https://stackoverflow.com/q/18725941). – Solarflare Apr 01 '22 at 16:02
  • @Solarflare there are using LIKE method can same things be done with MATCH AGAINST or I have to switch my query to use LIKE method? –  Apr 02 '22 at 08:40
  • You search using your current fulltext search. You just use the order by part from that answer. – Solarflare Apr 02 '22 at 09:20
  • @Solarflare this will do the job. thx your star –  Apr 06 '22 at 07:37

0 Answers0