David Balmain wrote:
> On 6/14/06, Marcus Crafter <[EMAIL PROTECTED]> wrote:
> 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.
Hi David,
Thanks mate for the information. I actually get the same problem when
attempting to use a writer:
@ramDIr = RAMDirectory.new
@writer = IndexWriter.new(@ramDir)
That gives me:
IOError: No file segments
/sw/lib/ruby/gems/1.8/gems/ferret-0.9.3/lib/ferret/store/ram_store.rb:79:in
`open_input'
/sw/lib/ruby/gems/1.8/gems/ferret-0.9.3/lib/ferret/index/segment_infos.rb:70:in
`read'
/sw/lib/ruby/gems/1.8/gems/ferret-0.9.3/lib/ferret/index/index_writer.rb:108:in
`initialize'
/sw/lib/ruby/gems/1.8/gems/ferret-0.9.3/lib/ferret/store/directory.rb:135:in
`while_locked'
/sw/lib/ruby/gems/1.8/gems/ferret-0.9.3/lib/ferret/index/index_writer.rb:103:in
`initialize'
/sw/lib/ruby/1.8/monitor.rb:229:in `synchronize'
/sw/lib/ruby/gems/1.8/gems/ferret-0.9.3/lib/ferret/index/index_writer.rb:102:in
`initialize'
I didn't think that was expected. Essentially I'm trying to the
following equivalent Lucene code:
protected void setUp() throws Exception
{
ramDir = new RAMDirectory();
IndexWriter writer = new IndexWriter(ramDir, new
StandardAnalyzer(),
true);
for (int i = 0; i < texts.length; i++)
{
addDoc(writer, texts[i]);
}
writer.optimize();
writer.close();
reader = IndexReader.open(ramDir);
numHighlights = 0;
}
The only way I've been able to get it to work is by using an on disk
index rather than a in-memory based one.
Any thoughts?
Cheers,
Marcus
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk