Thinking-Sphinx-Raspell 配置
我使用的是 Rails 2.3.4、sphinx 1.4.4 和 raspell 1.0.0。现在我想 在 sphinx 搜索中添加模糊匹配,因此我在 config/environment.rb 文件中添加了以下几行:
config = ThinkingSphinx::Configuration.instance
config.raspell.dictionary = 'en'
config.raspell.suggestion_mode = :badspellers
Ref - https://github.com/freelancing-god/thinking-sphinx-raspell
在启动我的服务器时,它会抛出这样的错误,
undefined method `raspell' for
#<ThinkingSphinx::Configuration:0xb63d7f8c> (NoMethodError)
你能帮我解决这个问题吗?
I am using rails 2.3.4 and sphinx 1.4.4 and raspell 1.0.0. Now I would like to
add fuzzy match in sphinx search, so I added in my config/environment.rb
file I added the following lines:
config = ThinkingSphinx::Configuration.instance
config.raspell.dictionary = 'en'
config.raspell.suggestion_mode = :badspellers
Ref - https://github.com/freelancing-god/thinking-sphinx-raspell
while starting my server it throws the error like this
undefined method `raspell' for
#<ThinkingSphinx::Configuration:0xb63d7f8c> (NoMethodError)
Can you help me on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果将该配置转移到初始化程序会发生什么?目前它位于 config/environment.rb 的顶部还是底部?它应该位于底部,在 Rails 自己的配置块之外(在处理该块之前不会加载 gem)。
What happens if you shift that configuration to an initialiser? And do you have it currently at the top or the bottom of config/environment.rb? It should be at the bottom, outside of Rails' own configuration block (gems aren't loaded until the block is processed).
这是由于 gem 版本造成的问题。
我修改了 gem 版本,这个问题现在已经解决了。
这里是 Gems 及其版本:
Thinking sphinx - 1.3.17
Active Record - 2.3.5
After Commit - 1.0.10
Riddle - 1.0.10
思考狮身人面像拉斯佩尔 - 1.1.1
拉斯佩尔 -1.3
This is the problem because of the gem versions.
I modified gem versions this issue is fixed now.
Here the Gems and its versions:
Thinking sphinx - 1.3.17
Active Record - 2.3.5
After Commit - 1.0.10
Riddle - 1.0.10
Thinking sphinx Raspell - 1.1.1
Raspell -1.3