English 中文(简体)
是否:在太阳站/固体可搜索方法中被 ?
原标题:Does :include inside a sunspot/solr searchable method do anything?

我的基准是我的索尔尔指数的2版,其中第1版包括:

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> 

Does anybody know if the includes are supposed to work? And if so, am I doing it wrong? I looked at the docs: http://outoftime.github.com/sunspot/rails/docs/ and see no mention of that.

最佳回答

, AP, :include

允许在指数化时积极按照规定协会负荷运作。

你的基准没有适当发挥作用,因为你正在把个人记录编入一个普通的Rubyer的索引。 由于你正在编造一个纪录的50倍,Sunspot公司根本无法利用急切的负荷。 相反,你应当:

Sunspot.index( User.limit(50) );
Sunspot.commit

Oh,如果以下几条速度快于上述速度,你能否测试? 我确实想知道。

Sunspot.index( User.includes(:account).limit(50) );
Sunspot.commit

还有一个bug,目前科学、技术和革新模式将忽视:include

问题回答

By looking at the SQL queries in the Rails log, you can see that :include on searchable causes eager loading while indexing. :include on #search caused eager loading while searching.





相关问题
Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

multiple ruby extension modules under one directory

Can sources for discrete ruby extension modules live in the same directory, controlled by the same extconf.rb script? Background: I ve a project with two extension modules, foo.so and bar.so which ...

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

热门标签