这是我第一次使用 InnoDB 使用全文搜索 mysql。正如我在文档中读到的那样,我可以选择在 (+) 加号前面添加更多的结果。
我的问题是,当用户输入任何单词时,我是否可以让默认搜索自动在前面添加 +。
例如。假设用户输入了以下内容:
- one two => (no + sign) 结果是 +one +two
- elliot wizard =>(没有 + 符号)会产生 +elliot +wizard
在 mysql 中它会搜索包含 + 的单词,即使用户实际上没有包含 +。
PS:我先在网上搜索了一下,没有找到解决这个问题的文章..
请帮忙。
问候,
最佳答案
你可以这样实现:
<?php
$string = 'This is the string';
$stringWithPlus = '+'.implode('+',explode(' ',$string));
echo $stringWithPlus;
?>
关于php - 在全文搜索mysql上设置默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36710474/