搜索部分带有教义的词
我正在尝试使用 codeigniter 和原则执行全文搜索。 我的问题是 Doctrine 仅对整个单词执行搜索。
例如,我正在搜索“山”,我得到的每个条目都带有“山”一词。 但如果我搜索“mount”,我什么也得不到。
I am trying to perform fulltext search with codeigniter and doctrine.
My problem is that Doctrine perform the search only on wholes words.
For exemple, il I'am searching "mountain", I get every entry with the word mountain.
But If I'am searching "mount", I get nothing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 Symfony 1.4 和 Doctrine 1.2 的可搜索行为中遇到了同样的问题,并遇到了这个问题。然后我发现您可以将通配符(?或*)添加到适用于单词的搜索词中。在你的情况下,“mount*”将匹配 mountain。就我而言,我将其应用于每个搜索词并向用户隐藏。
希望这对某人有帮助!
-- 编辑 --
上面有点仓促地发布了...这对于单个单词查询非常有效,但在多个部分单词上再次失败。像这样的东西应该效果更好:
I had the same problem with Symfony 1.4 and Doctrine 1.2 with the Searchable behaviour and came across this question. I then found you can add wildcards (? or *) to the search term which applies to the words. In your case "mount*" would match mountain. In my case I applied this to each search term and hid it from the user.
Hope this helps someone!
-- edit --
Posted a little hastily above... This works great for single word queries, but fails again on multiple partial words. Something like this should work better: