user4504362
user4504362

Reputation:

keywords with - and /

I need to search for keywords containing - or / for example: 2019-45 or 2019/1258 when I search for 2019-45 MySQL return two records containing: 2019-45 for the first and 2019/45 for the second (these two data do not mean the same thing for me). In my request (in boolean mode) I use '"2019-45"'

match (title) against (mykeysword in mode)> 0

Apparently, even with double quotes the fulltext does not take into account the - or /

How to take into account - or / ? thank you Didier

thanks for yours answers

this is my code

CREATE DEFINER=devops_admin@% PROCEDURE sp_cherche(in f_texte VARCHAR(255)) BEGIN SELECT id_rech, titre, MATCH(titre) AGAINST(f_texte in boolean mode) as quotation FROM tab_references WHERE MATCH(titre) AGAINST(f_texte in boolean mode) >0 END

When I call :

sp_recherche('"2018-45"') ou sp_recherche('"2018/45"')

this two calls give the same result, in my exemple 2 answers.

It is not my MySQL server, it is a provider. Thaks you for the link, but I dont understant anything on the mapping (sorry) If y understand, need to say that - and / are caracters.

thanks

Didier

Upvotes: 1

Views: 28

Answers (1)

spencer7593
spencer7593

Reputation: 108480

The default characterset for MySQL Full Text Search does not recognize the - or / characters as "letters". To get those recognized as letters, the characterset can be modified, as documented here in the MySQL Reference Manual:

https://dev.mysql.com/doc/refman/5.7/en/fulltext-fine-tuning.html#fulltext-modify-character-set

Upvotes: 1

Related Questions