我今天学习了 Sunspot_rails 项目,
请参阅我的演示剪辑:http: //youtu.be/qmtbDg4VtOw
并且每当将新项目添加到数据库中时,
我们应该做
rake sunspot:reindex
这样我们就可以通过太阳黑子搜索来搜索新添加的日期。
有没有更好的方法
自动地
跑
rake sunspot:reindex
数据库何时更改?
提前致谢
PS:如果在命令行中运行 rake sunspot:reindex,它会显示确认提示。我可以禁用该选项吗?[书籍] $ rake sunspot:reindex
*Note: the reindex task will remove your current indexes and start from scratch.
If you have a large dataset, reindexing can take a very long time, possibly weeks.
This is not encouraged if you have anywhere near or over 1 million rows.
Are you sure you want to drop your indexes and completely reindex? (y/n)
# Sunspot
searchable do
text :name
text :author
text :comment
text :sale_type
text :category
# text :isbn
end
太阳黑子.yml
[config] $ cat sunspot.yml
production:
solr:
hostname: localhost
port: 8983
log_level: WARNING
# read_timeout: 2
# open_timeout: 0.5
development:
solr:
hostname: localhost
port: 8982
log_level: INFO
test:
solr:
hostname: localhost
port: 8981
log_level: WARNING