Ferret file not found error on item delete

Hi ferreters:

I’ve already posted this in rails, but someone there suggested this
would be better.

I’m getting a ferret error when I try to delete any item that has been
previously indexed. I just installed ferret, so the indexes aren’t big
or anything. What I’m trying to do is to just delete an item on a table
that has been index. Here’s the error I’m getting:

Processing GoalsController#destroy (for 68.83.170.192 at 2007-05-22
08:05:39) [DELETE]
Session ID: ae7fa224cbeac580bac6fa4c9c250a03
Parameters: {"_method"=>“delete”, “action”=>“destroy”, “id”=>“105”,
“controller”=>“goals”}

Ferret::FileNotFoundError (File Not Found Error occured at
<except.c>:117 in xpop_context
Error occured in fs_store.c:329 - fs_open_input
tried to open
“/var/www/apps/goal_buddy/current/config/…/index/production/goal/_2s_0.del”
but it doesn’t exist:

):
/usr/lib/ruby/gems/1.8/gems/ferret-0.11.4/lib/ferret/index.rb:285:in
delete' /usr/lib/ruby/gems/1.8/gems/ferret-0.11.4/lib/ferret/index.rb:285:in<<’
/usr/lib/ruby/gems/1.8/gems/ferret-0.11.4/lib/ferret/index.rb:8:in
synchrolock' /usr/lib/ruby/1.8/monitor.rb:229:insynchronize’
/usr/lib/ruby/gems/1.8/gems/ferret-0.11.4/lib/ferret/index.rb:8:in
synchrolock' /usr/lib/ruby/gems/1.8/gems/ferret-0.11.4/lib/ferret/index.rb:267:in<<’
/usr/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/local_index.rb:140:in
<<' /usr/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/instance_methods.rb:73:inferret_update’

As I really don’t know ferret and acts_as_ferret well, any help you
could give would be greatly appreciated!

Thanks!

Mike

Hey …

Parameters: {“_method”=>“delete”, “action”=>“destroy”, “id”=>“105”,
“controller”=>“goals”}

i’m not sure i understand what you want to do … if you want to clear
your
index, you can use Index :create => true option [1]

The error you are getting can have various reasons, like two writers
writing the same index. Can you post a little more information about
what you want to do and maybe the code that throws the exception?

Ben

[1] http://ferret.davebalmain.com/api/classes/Ferret/Index/
IndexWriter.html

On Tue, May 22, 2007 at 05:30:32PM +0200, Mike D. wrote:

Hi Ben:

Thanks so much for getting back to me. I don’t know if/how to find out
if two writers are looking to write the same index at the same time.
What it appears is that the item that needs to be deleted “goal” is an
indexed item, and thus ferret must do something when an indexed item
wants to be deleted. That’s when I get the error - it’s almost as if
ferret is doing some good cleanup but then can’t find the file to
cleanup. Does ferret/acts as ferret delete an associated index when the
item is deleted? If so how do I make that delete code stronger?

Yes, acts_as_ferret is all about keeping your DB and the Ferret index in
sync.

Better yet, does recreating indexes solve the problem? If so, I
didn’t/don’t really understand how interact with ferret such that I
could force it to recreate the index, if that would solve the problem,
so direction there would be helpful as well.

you can rebuild acts_as_ferret’s index from the Rails console with

Goal.rebuild_index

And yes, rebuilding the index should solve the problem. If this happened
to you in production mode, be sure to check out acts_as_ferret’s DRb
server
which will prevent problems like this.

Jens


Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
[email protected] | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa

Ok, well, thanks for that information. So, I added the rebuild index to
delete method for a goal, and now I get an error when I try and create a
goal - the same error! What’s the proper way to deal with ferret when I
delete or create records - so far it’s not been very helpful at all when
the index changes.

I also tried to execute an index rebuild from my command line and that
didn’t make any change. Do I need to stop/start the server?

Thanks again for your help!

Mike

Hi Ben:

Thanks so much for getting back to me. I don’t know if/how to find out
if two writers are looking to write the same index at the same time.
What it appears is that the item that needs to be deleted “goal” is an
indexed item, and thus ferret must do something when an indexed item
wants to be deleted. That’s when I get the error - it’s almost as if
ferret is doing some good cleanup but then can’t find the file to
cleanup. Does ferret/acts as ferret delete an associated index when the
item is deleted? If so how do I make that delete code stronger?

Better yet, does recreating indexes solve the problem? If so, I
didn’t/don’t really understand how interact with ferret such that I
could force it to recreate the index, if that would solve the problem,
so direction there would be helpful as well.

Thanks very much again, and in advance, for your help!

Mike

Benjamin K. wrote:

Hey …

Parameters: {“_method”=>“delete”, “action”=>“destroy”, “id”=>“105”,
“controller”=>“goals”}

i’m not sure i understand what you want to do … if you want to clear
your
index, you can use Index :create => true option [1]

The error you are getting can have various reasons, like two writers
writing the same index. Can you post a little more information about
what you want to do and maybe the code that throws the exception?

Ben

[1] http://ferret.davebalmain.com/api/classes/Ferret/Index/
IndexWriter.html

On Tue, May 22, 2007 at 07:11:50PM +0200, Mike D. wrote:

Ok, well, thanks for that information. So, I added the rebuild index to
delete method for a goal, and now I get an error when I try and create a
goal - the same error! What’s the proper way to deal with ferret when I
delete or create records - so far it’s not been very helpful at all when
the index changes.

You got me wrong here - you definitely should not rebuild the index
every time a goal is deleted.

I also tried to execute an index rebuild from my command line and that
didn’t make any change. Do I need to stop/start the server?

Is this on your development machine or in a production setup?
Usually there is no need to call rebuild_index manually in development
mode, just stop the server, delete the index directory and start the
server again.

In production mode, use the DRb server and use rebuild_index via the
rails console if needed.

If this still doesn’t work out we would need some more information
(logs) to see what’s going on.

Jens


Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
[email protected] | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa

Any additional help here? Thanks in advance!