我正在用照片构建一个数据库。通过使用布尔搜索,我为使用的搜索(短语)获得了正确的图像。
现在我有这个问题:在许多描述中,标记了人员或主题的电子邮件地址。喜欢 my.name@telenet.be现在,当我想查找Telenet公司的图像时,我会获得包含提供商电子邮件地址的所有记录。谁对我的搜索没有无能为力。
这是我的搜索示例:
SELECT ID,auteur, title, datetaken, description,
keywords,thumbnail,URL,rel_date,showa,initialen,type
FROM archief
WHERE MATCH(description, keywords) AGAINST(' +telenet ' IN BOOLEAN
MODE) AND rechten <> '0' AND showa = '1' AND type >= '2' AND rel_date
<= '20120921' ORDER BY datetaken desc LIMIT 60'
in 'where clause'
如何过滤掉包含@
符号的搜索短语?
我认为您可以尝试 REGEXP 运算符,在您的原因中,它看起来像:
SELECT *
FROM archief
WHERE
description REGEXP '[^@]telenet' OR
keywords REGEXP '[^@]telenet'
此查询应选择包含字符串telenet
且description
或keywords
字段中没有前面@
的所有记录。