做什么:在太阳黑子/ solr搜索方法中包含什么内容?
问题描述:
我基准2版我的Solr索引的第一个具有以下包括语句:做什么:在太阳黑子/ solr搜索方法中包含什么内容?
searchable(:auto_index => false, :auto_remove => true,
:include => { :account => true,
:user_practice_contact => [:city],
:user_professional_detail => [:specialty, :subspecialties]}) do
第二:
searchable(:auto_index => false, :auto_remove => true) do
我期待看到一个减速的版本包括但在这里是结果:
版本包括:
Benchmark.measure { User.limit(50).each do |u|; u.index; end; Sunspot.commit; }
=> #<Benchmark::Tms:0x1130b34e8 @real=6.8079788684845, @utime=5.05, @cstime=0.0, @cutime=0.0, @total=5.2, @label="", @stime=0.149999999999999>
和不包括:
Benchmark.measure { User.limit(50).each do |u|; u.index; end; Sunspot.commit; }
=> #<Benchmark::Tms:0x112ef0fe8 @real=6.82465195655823, @utime=4.92, @cstime=0.0, @cutime=0.0, @total=5.07, @label="", @stime=0.15>
有谁知道,如果包括应该工作?如果是这样,我做错了吗? 我看了一下文档:http://outoftime.github.com/sunspot/rails/docs/,并没有提到这一点。
答
通过查看Rails日志中的SQL查询,您可以看到:include
在可搜索的页面上导致在索引编制时进行加载。 #search
上的:include
在搜索时导致急切加载。