我想在文本中搜索$ prefiexed的单词。
样本记录(包含3行的表):
This is my string containing the $word special word.
Again $word is here.
My special $word must be found.
示例RoR(思考狮身人面像):
MyModel.search '$word'
我没有得到任何结果但是如果我搜索'\ $ word'这个词就找到了。
我该如何解决?
答案 0 :(得分:3)
Sphinx使用除英文字母之外的任何字符作为单词分隔符。这意味着'$'从未编入索引并等效于空格。你无法找到它。
请参阅http://sphinxsearch.com/docs/current.html#conf-charset-table
在你的config / sphinx.yml中添加如下内容:
charset_table: 0..9, A..Z->a..z, _, a..z, $
重建,重新启动并找到它!