认为 Sphinx 没有为某些模型建立索引
这很奇怪。我有 3 个型号(A、B、C)。当 crontab 运行时,我们工作得很好。
最近,我在为模型 A 建立新条目索引时遇到问题。
当我手动调用 rake ts:index RAILS_ENV=Production 时,索引运行良好。没有错误,有问题。但是,只有模型 B、C 得到更新。模型 A 未更新。我检查了所有日志,没有任何问题。
这是 searchd.log
:
[Mon Nov 29 15:02:27.920 2010] [ 7280] rotating indices (seamless=1)
[Mon Nov 29 15:02:28.211 2010] [ 7280] rotating index 'b_core': success
[Mon Nov 29 15:02:28.215 2010] [ 7280] rotating index 'c_core': success
[Mon Nov 29 15:02:28.216 2010] [ 7280] rotating finished
在这里您会注意到 a_core
没有出现。所有这些都在工作正常的情况下进行。当我看到它运行时,它正在索引 A
,但是当我在上次更新时检查我的 sphinx 数据库时,它没有更新。所有 Sphinx 数据库的权限都是相同的。
让索引运行良好的唯一方法是删除旧的 sphinx 数据库,并调用整个 ts:rebuild。不过,我还没有尝试删除 development.sphinx.conf
。
在这种情况发生之前,我过去确实尝试过添加增量索引。嗯,增量索引无法正常工作,但正常索引没问题。然后,模型 A 的索引损坏了。无论如何我都没有意识到它损坏了。然后我关闭了增量索引而不删除该列。 (我仍然不知道模型 A 的索引运行良好)。然后今天我发现模型 A 索引存在问题。所以我想也许我没有删除数据库中的增量列。所以我删除了该列,重新启动了 MySQL、Apache,模型 A 索引仍然没有更新。
实际上我不认为这与增量索引有什么关系。因为我添加了所有 A、B、C 模型的增量索引,然后又删除了它。如果它损坏了,它应该损坏所有模型,而不是仅损坏一个模型。
请帮忙。谢谢。
编辑 型号A
# ThinkingSphinx Index
define_index do
indexes :name, :sortable => true
indexes address
indexes city
indexes state
indexes country
indexes spot_type
indexes season
indexes description
has rating_average
# set_property :delta => true
end
型号B
# ThinkingSphinx Index
define_index do
indexes name
indexes duration
has budget, created_at, rating_average
# set_property :delta => true
end
This is quite strange. I have 3 models (A, B, C). Were working perfectly when crontab runs it.
Recently, I was having problem with indexing new entries for model A.
When I invoke rake ts:index RAILS_ENV=production
manually, indexing runs fine. No error, problem. But, only model B, C get updated. Model A doesn't get updated. I checked all the logs, there wasn't any problem.
Here's searchd.log
:
[Mon Nov 29 15:02:27.920 2010] [ 7280] rotating indices (seamless=1)
[Mon Nov 29 15:02:28.211 2010] [ 7280] rotating index 'b_core': success
[Mon Nov 29 15:02:28.215 2010] [ 7280] rotating index 'c_core': success
[Mon Nov 29 15:02:28.216 2010] [ 7280] rotating finished
Here you will notice a_core
doesn't appear. All these while it was working fine. When I saw it running, it was indexing A
, but when I checked my sphinx db when it was last updated, it was not updated. Permission for all Sphinx db is all the same.
The only way to get the indexing running well is to remove old sphinx db, and invoke an entire ts:rebuild
. I haven't tried removing the production.sphinx.conf
though.
I did try to add delta indexing in the past before this happened. Well, delta indexing couldn't work somehow, but the normal indexing was fine. Then, the indexing broke for model A. I didn't realize it broke anyway. Then I turned off delta indexing without removing the column. (I still didn't know indexing was running fine for model A). Then today I found out there was problem with model A indexing. So I thought maybe I didn't remove the delta column in my database. So I removed the column, restarted MySQL, Apache, and model A index still doesn't get updated.
I actually don't think it has something to do with delta indexing. Because I added, then removed delta indexing for all A, B, C models. If it should break, it should break all instead of just one model.
Please help. Thank you.
EDIT
Model A
# ThinkingSphinx Index
define_index do
indexes :name, :sortable => true
indexes address
indexes city
indexes state
indexes country
indexes spot_type
indexes season
indexes description
has rating_average
# set_property :delta => true
end
Model B
# ThinkingSphinx Index
define_index do
indexes name
indexes duration
has budget, created_at, rating_average
# set_property :delta => true
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,我的服务器磁盘空间不足。模型A的指数比其他模型大得多。即使索引成功,它也无法写入磁盘(尽管没有错误输出)。但当我不断尝试向模型 A 添加越来越多的内容并不断重建时,磁盘空间问题就显现出来了。
所以我增加了磁盘大小。现在好了。
It turned out, my server ran out of disk space. Model A index is very much larger than other models. Even though indexing was successful, it couldn't write to the disk (though there was no error ouput). But as I kept trying to add more and more contents to model A, and kept rebuilding, the disk space problem showed.
So I increased my disk size. Now it's fine.