How to use prefix wildcards like '*abc' with match-against

前端 未结 2 619
悲哀的现实
悲哀的现实 2021-01-21 08:06

I have the following query :

SELECT * FROM `user` 
WHERE MATCH (user_login) AGAINST (\'supriya*\' IN BOOLEAN MODE)

Which outputs all the record

2条回答
  •  我在风中等你
    2021-01-21 08:31

    I believe the selection of FULL-TEXT Searching isn't relevant here. If you are interested in searching some fields based on wildcards like:

    • %word% ( word anywhere in the string)
    • word% ( starting with word)
    • %word ( ending with word)

    best option is to use LIKE clause as GolezTrol has mentioned.

    However, if you are interested in advanced/text based searching, FULL-TEXT search is the option.

    Limitations with LIKE:

    There are some limitations with this clause. Let suppose you use something like '%good' (anything ending with good). It may return irrelevant results like goods, goody.

    So make sure you understand what you are doing and what is required.

提交回复
热议问题