"tried to use a closed index"

Sorry in advance for the newbie question. Can’t get aaf going and can’t
find similarly stuck folks on this forum.

I’m running Rails on my local machine in development mode. I installed
ferret 0.11.0 gem, and the most recent stable aaf plugin (as of today).

I’m having trouble getting the most basic functionality working. In my
model Recipe, I have:

acts_as_ferret :fields => [:handle, :introduction, :ingredients,
:steps],
:single_index => true

In my search controller, I have:

@results = Recipe.find_by_contents(params[:search_query])

If the index doesn’t exist yet, then the above will do the following:

  1. throw the following error:

RuntimeError (tried to use a closed index):
/usr/local/lib/ruby/gems/1.8/gems/ferret-0.11.0/lib/ferret/index.rb:695:in
`ensure_searcher_open’

  1. write the following log entries:

rebuild index: []
reindexing model Recipe
reindex model Recipe : 0.00% complete : 2.08 secs to finish
Created Ferret index in: script/…/config/…/index/development/shared
rebuild index: []
reindexing model Recipe
reindex model Recipe : 0.00% complete : 1.86 secs to finish
Created Ferret index in: script/…/config/…/index/development/shared
rebuild index: []
reindexing model Recipe
reindex model Recipe : 0.00% complete : 1.96 secs to finish
Created Ferret index in: script/…/config/…/index/development/shared
query: +(id:test class_name:test introduction:test ingredients:test
handle:test steps:test) +class_name:Recipe
stored_fields:

Apparently, aaf is indexing the recipes table not once, not twice, but
three separate times. Still, a proper index does seem to be created (ie.
I crack open the generated “_11.cfs” file and sure enough, it has pieces
of words from the recipes table).

Yet even though it seems the index is being (inefficiently?) generated,
find_by_contents fails because it thinks the index is closed.

Anybody have a clue on where I might look for an answer to this problem?

Thanks

Peter

Argh. Problem turned out to that annoying bug in method
ensure_index_exists within local_index.rb of aaf. ensure_index_exists
looks for a file called “segments”, but ferret 0.11.0 uses files called
“segments.gen” and “segments_[stuff]”.

Oh well, at least I can say that this otherwise wasted Saturday bought
me an intimate understanding of the working of aaf.

On Sun, Apr 15, 2007 at 07:29:07AM +0200, Peter Savich wrote:

Argh. Problem turned out to that annoying bug in method
ensure_index_exists within local_index.rb of aaf. ensure_index_exists
looks for a file called “segments”, but ferret 0.11.0 uses files called
“segments.gen” and “segments_[stuff]”.

The later 0.11.x ferret versions use segments as filename again, that’s
why this is the way it is in aaf.

Oh well, at least I can say that this otherwise wasted Saturday bought
me an intimate understanding of the working of aaf.

That can always be useful :slight_smile:
I’ll have a look at the 3-times-index-rebuild issue.

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