Hi all,
I’ve ran into a problem with Ferret on my rails app, and I don’t
really have a clue about why. When running the unit tests, I get the
following error output:
acts_as_ferret/lib/acts_as_ferret.rb:470:in latest?' index.rb:293:in
<<’
/opt/local/lib/ruby/1.8/monitor.rb:229:in synchronize' /opt/local/lib/ruby/gems/1.8/gems/ferret-0.9.1/lib/ferret/index/ index.rb:258:in
<<’
/Users/sk/Documents/svn/cms/branches/nodes/vendor/plugins/
acts_as_ferret/lib/acts_as_ferret.rb:407:in `ferret_update’
(…)
The problem seems to be caused by the following code in acts_as_ferret:
@sub_readers.each { |r| return false unless r.latest? }
which, in turn, causes a NoMethodError because @segment_infos is nil.
The problem (or, at least, the symptom) goes away when I add a rescue
clause inside the block that gets passed to @sub_readers.each, but it
feels like a bad way of solving it. Anyone who knows why this happens
in the first place? And what should I do to avoid it?
//samuel
Samuel Kvarnbrink
mail: [email protected]
blog: http://samuelk.info
"I once had a problem.
I thought: “Oh, I know: I’ll just use XML!”
Now I had two problems."
Hi Samuel
This is beeing discussed under ticket #6 on the aaf trac
http://projects.jkraemer.net/acts_as_ferret/ticket/6
A fair number of test problems with aaf has been resolved with the newly
released ferret 0.9.2 and the trunk version of aaf but I haven’t had
time to check for this problem.
Kasper
Samuel Kvarnbrink wrote:
Hi all,
I’ve ran into a problem with Ferret on my rails app, and I don’t
really have a clue about why. When running the unit tests, I get the
following error output:
acts_as_ferret/lib/acts_as_ferret.rb:470:in latest?' index.rb:293:in
<<’
/opt/local/lib/ruby/1.8/monitor.rb:229:in synchronize' /opt/local/lib/ruby/gems/1.8/gems/ferret-0.9.1/lib/ferret/index/ index.rb:258:in
<<’
/Users/sk/Documents/svn/cms/branches/nodes/vendor/plugins/
acts_as_ferret/lib/acts_as_ferret.rb:407:in `ferret_update’
(…)
The problem seems to be caused by the following code in acts_as_ferret:
@sub_readers.each { |r| return false unless r.latest? }
which, in turn, causes a NoMethodError because @segment_infos is nil.
The problem (or, at least, the symptom) goes away when I add a rescue
clause inside the block that gets passed to @sub_readers.each, but it
feels like a bad way of solving it. Anyone who knows why this happens
in the first place? And what should I do to avoid it?
//samuel
Samuel Kvarnbrink
mail: [email protected]
blog: http://samuelk.info
"I once had a problem.
I thought: “Oh, I know: I’ll just use XML!”
Now I had two problems."