acts_as_xapian 作业表
有人可以向我解释acts_as_xapian_jobs 表的内部工作原理吗?
我最近遇到了 acts_as_xapian
插件的问题,当它创建带有 xapian 索引字段的对象时,我不断收到以下错误:
Mysql::Error: Duplicate entry 'String-2147483647' for key 2:
INSERT INTO `acts_as_xapian_jobs` (`action`, `model`, `model_id`)
VALUES ('update', 'String', 23730251831560)
事实证明 model_id
超出了最大值int 值 2147483647。解决方法是更新 model_id
以使用 bigint。 为什么 model_id
这么大? 通过查看acts_as_xapian_jobs的内容,它似乎为正在索引的每个字段创建一行。 了解工作是如何在表中创建的将会有很大帮助。
这是表格的示例:
mysql> select * from acts_as_xapian_jobs limit 5\G
*************************** 1. row ***************************
id: 19
model: String
model_id: 23804037900560
action: update
*************************** 2. row ***************************
id: 49
model: String
model_id: 23804037191200
action: update
*************************** 3. row ***************************
id: 79
model: String
model_id: 23804037932180
action: update
*************************** 4. row ***************************
id: 109
model: String
model_id: 23804037101700
action: update
*************************** 5. row ***************************
id: 139
model: String
model_id: 23804037722160
action: update
提前致谢,
Amie
Can someone explain to me the inner workings of acts_as_xapian_jobs table?
I ran into an issue with the acts_as_xapian
plugin recently, where I kept getting the following error when it creates an object with xapian indexed fields:
Mysql::Error: Duplicate entry 'String-2147483647' for key 2:
INSERT INTO `acts_as_xapian_jobs` (`action`, `model`, `model_id`)
VALUES ('update', 'String', 23730251831560)
It turns out the model_id
exceeded the max int value of 2147483647. The workaround was to update model_id
to use bigint. Why would the model_id
be so huge? By looking at content of acts_as_xapian_jobs
, it seems it creates a row for every field that is being indexed..
Understanding how a job gets created in the table would help a great deal.
Here's a sampling of the table:
mysql> select * from acts_as_xapian_jobs limit 5\G
*************************** 1. row ***************************
id: 19
model: String
model_id: 23804037900560
action: update
*************************** 2. row ***************************
id: 49
model: String
model_id: 23804037191200
action: update
*************************** 3. row ***************************
id: 79
model: String
model_id: 23804037932180
action: update
*************************** 4. row ***************************
id: 109
model: String
model_id: 23804037101700
action: update
*************************** 5. row ***************************
id: 139
model: String
model_id: 23804037722160
action: update
Thanks in advance,
Amie
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最近发现了 acts_as_xapian 并且我一直在尝试它。 似乎每次模型更改时
acts_as_xapian_jobs
表都会更新。 然后,Xapian 索引会在下次运行 rake xapian:update_index 时实际更新。因此,acts_as_xapian_jobs 表基本上只包含模型中需要重新索引的记录的 ID。 据我所知,只有当您的模型发生更改时,记录才会添加到表中,因此 - 您是否正在更改/更新数据库中的大量条目? 这可能就是您溢出最大 int 值的原因。
希望这可以帮助!
I've recently discovered acts_as_xapian and I've been playing around with it a bit. It seems like the
acts_as_xapian_jobs
table gets updated any time a model is changed. Then, the Xapian index is actually updated the next timerake xapian:update_index
is run.So, the
acts_as_xapian_jobs
table basically just contains the ids of records in the model which need to be re-indexed. As far as I can tell, records only get added to the table when your model has changed, so -- are you changing/updating lots of entries in your database? This might be why you've overflowed the max int value.Hope this helps!