Raj Singh wrote:
> This problem is back and now I know the pattern.
>
> I rebuilt the index and things started working. Then I started adding
> events again to the application. After adding 60/70 events the problem
> was back. I got the exception because of
>
> End-of-File Error occured at <except.c>
>
> Then I rebuilt the index and it started working. Again I had the same
> issue after I added 50/60 records.
>
> Am I missing something here. I am using ferret 0.10.9 and the latest
> acts_as_ferret plugin.
>
> Thanks
In case anybody comes across this thread...I had a similar problem, but
discovered that is was happening because I was trying to write to my
Model with update_attribute (updating a posting view stat) within the
same method I was running the search from with AAF. The solution for me
was to include a
model.disable_ferret(:once)
statement in the write procedure within my controller action so that AAF
didn't try to update the index (to a field that didn't matter anyway,
though I had explicitly excluded it from the :fields array in Model.rb)
while running a search at the same time. So now my code looks like this:
def search
@models = Model.find_by_contents('foo')
@models.each do |m|
@model = Model.find(m.id)
@model.disable_ferret(:once)
@model.update_attribute('views', if @model.views == 0 then 1
else @views + 1 end)
end
end
This also greatly improved my search speed.
You can read more here ->
http://projects.jkraemer.net/acts_as_ferret/wiki/AdvancedUsage
Hope this helps someone.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk