gpt4 book ai didi

MySql 完整索引搜索不起作用

转载 作者:行者123 更新时间:2023-11-29 07:50:18 26 4
gpt4 key购买 nike

我在这里设置示例代码

http://sqlfiddle.com/#!2/6aa9ec/1

Below mentioned DB query used for searching the word Samsung but its not working

SELECT `idREQUEST`, `USER_NAME`, `idCATEGORY`, `TITLE`, `DESCRIPTION`, `IMAGE_URL1`, `IMAGE_URL2`, `IMAGE_URL3`, `POST_DATE`
FROM `requests`
WHERE MATCH (`TITLE`,`DESCRIPTION`) AGAINST('Samsung')

最佳答案

您可以使用Boolean Full-Text Searches

SELECT `idREQUEST`,
`USER_NAME`,
`idCATEGORY`,
`TITLE`,
`DESCRIPTION`,
`IMAGE_URL1`,
`IMAGE_URL2`,
`IMAGE_URL3`,
`POST_DATE`
FROM `requests`
WHERE MATCH (`TITLE`,`DESCRIPTION`) AGAINST('+Samsung' IN BOOLEAN MODE)

According to docs

MySQL can perform boolean full-text searches using the IN BOOLEAN MODE modifier. With this modifier, certain characters have special meaning at the beginning or end of words in the search string. In the following query, the + operator indicate that a word is required to be present, respectively, for a match to occur.

DEMO

关于MySql 完整索引搜索不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26628814/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com