思考狮身人面像不索引新添加的记录 [英] Thinking Sphinx not indexing newly added records

查看:40
本文介绍了思考狮身人面像不索引新添加的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 sphinx 搜索 2 个模型及其关联.我正在使用增量索引.在开发模式 (Ubuntu) 下,我的开发箱上一切正常.但是,在暂存盒生产环境中,当我创建新记录时,我需要再次构建索引以使新创建的记录可搜索.更奇怪的是,当我使用脚本/控制台创建记录时,它们似乎被索引并且可以搜索.

I am using sphinx to search on 2 models along with their associations. I am using delta indexing. Things work fine on my dev box in dev mode (Ubuntu). However, on staging box production env, when I create new records, I need to build the index again in order to make the newly created records searchable. Even weird is that when I create records using script/console, they seem to be getting indexed and are searchable.

为了使关联在更新后起作用,我为所有将这两个模型记录的增量设置为 true 的关联模型使用了 after_save 方法.我不确定这是否与此有关.

For the associations to work after update, I have an after_save method for all the association models that set the delta of these two model records to true. I am not sure if this has anything to do with this.

我检查了权限,认为 sphinx gem 版本,它们似乎都很好.可能有什么问题?

I have checked for permissions, thinking sphinx gem version and they all seem to be fine. What could be wrong?

编辑

我还查看了 http://freelancing-god.github.com/ts/en/common_issues.html#deltas 但它似乎不起作用.是的,服务器在 phusion 乘客上运行.

I have also checked out http://freelancing-god.github.com/ts/en/common_issues.html#deltas but it doesn't seem to work. And yes the server runs on phusion passenger.

推荐答案

我遇到了类似的问题,我认为这是一个依赖项解析问题.

I had something like this exact issue, and I think it was a dependency resolution issue.

查看我的帖子这里.

不知何故,我认为我的机器上通过 gem 安装了更新版本的 thinking-sphinx,但我仍然通过 apt-get 安装了它.我用apt清除了它,然后重新安装了它.后来,我发现我的表中有一个不应该使用的特殊字段,:type,我编辑迁移以删除该类型并重新添加为不同的名称.然后它起作用了.您应该发布您的相关代码,用于模型、调用搜索的控制器操作、调用任何 rake 命令时的任何显眼输出.尝试卸载 gem,然后重新安装它.然后卸载apt包,重新安装.

Somehow, I think an updated version of thinking-sphinx got installed on my machine via a gem, and I still had it installed via apt-get. I purged it with apt, and then reinstalled it. Afterward, I found that I had a special field in a table that should not be used, :type, and I edited the migration to remove the type and add it again as a different name. Then it worked. You should post your relevant code, for the models, the controller action that calls search, any conspicuous output on calling any of the rake commands. Try uninstalling the gem and then reinstalling it. Then uninstall the apt package, and reinstall it.

这篇关于思考狮身人面像不索引新添加的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆