MySql 完整索引搜索不起作用

标签 mysql full-text-search

我在这里设置示例代码

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/

相关文章:

mysql - Rails Arel 通过连接表上的 where 条件进行连接

c# - 如何将最后几个数字存储为表行中的变量

php - 是否可以为这个作业 : select, 编写一个 sql 查询然后比较然后插入/更新

mysql - INNER JOIN 用作 SELECT 但不用作 DELETE

django - 带有django-haystack的Elasticsearch自动运行更新索引

php - 使用 PHP 进行正确且方便的错误处理和日志记录

sql-server - 全文搜索排名(SQL Server)

sql - 使用 PostgreSQL 查找流行字符串

PHP搜索多个字段问题

full-text-search - 如何为 B2B 网络应用程序设置 Lucene/Solr?