使用 Sphinx 搜索 $word (Thinking Sphinx)
我想在文本中搜索以 $ 为前缀的单词。
示例记录(包含 3 行的表):
This is my string containing the $word special word.
Again $word is here.
My special $word must be found.
示例 RoR(思考 sphinx):
MyModel.search '$word'
我没有得到任何结果,但如果我搜索 '\$word',就会找到该单词。
我该如何解决这个问题?
I would like to search text for words prefiexed by $.
Sample records (table with 3 rows):
This is my string containing the $word special word.
Again $word is here.
My special $word must be found.
Example RoR (thinking sphinx):
MyModel.search '$word'
I get no results but if I search for '\$word' the word is found.
How can I fix that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Sphinx 使用除英文字母之外的任何字符作为单词分隔符。这意味着“$”从未被索引,相当于空格。没办法你能找到它。
请参阅 http://sphinxsearch.com/docs/current.html#conf-charset- table
在您的 config/sphinx.yml 中添加类似以下内容:
重建,重新启动并找到它!
Sphinx uses as word separators ANY character except English alphabet. This means '$' in never indexed and equivalent to a blank space. No way you can find it.
See http://sphinxsearch.com/docs/current.html#conf-charset-table
In your config/sphinx.yml add something like:
rebuild, restart and find it !