On 6/14/06, Marcus Crafter <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> Hope all is going well.
>
> I'm having trouble with the following code creating an in memory index
> reader - it seems to be attempting to read from a file regardless.
> Here's the simple code:
>
> require 'rubygems'
> require 'ferret'
>
> a = Ferret::Index::Index.new
> r = Ferret::Index::IndexReader.new(nil)
>
>
> Running the code on my OS X machine gives:
>
> marcus-crafters-powerbook-g4-17:/tmp crafterm$ ruby t.rb
> t.rb:5:in `initialize': : Error occured at <fs_store.c>:318 (Exception)
> Error: exception 2 not handled: Couldn't open the file to read
>         from t.rb:5
>
> The IndexReader API says pass nil in for an in memory directory, so I'm
> not sure what's wrong.
>
> Is this a bug - any ideas at all? This is ferret 0.9.3 for reference.

Hi Marcus,

Sorry, this is a mistake in the docs. It doesn't make sense to open an
IndexReader with an anonymous RAMDirectory as it obviously won't
contain any index yet. The problem is that the IndexReader is trying
to read the segments file which it expects to be there but, since no
index has been written, there is no segments file. If you pass a
RAMDirectory that actually contains an index written by an IndexWriter
or Index class then it should work.

Cheers,
Dave
> Cheers,
>
> Marcus
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ferret-talk mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/ferret-talk
>
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to