[Ferret-talk] Parallel indexing doesn''t work?

Noah M. Daniels
Wed, 09 Jan 2008 21:02:17 -0000

Hi,

I''m trying to get parallelized ferret indexing working for my AAF
indices, based on the example in the O''Reilly Ferret shortcut.
However, the resulting indices after merging seem to have no actual
documents.

I went and made minimal changes to the example in the Ferret shortcut
pdf, and indeed can''t get that to work either. I''d appreciate
any help
anyone can give! Thanks!

The example is below:

#!/usr/bin/env ruby

require ''rubygems''
require ''ferret''
include Ferret::Index

5.times do |i|
   name = "index#{i}"
   puts name
   i = Ferret::I.new(:path => "/tmp/#{i}", :create => true)
   i << {:name => name}
   i.close
end
readers = []
readers << IndexReader.new("/tmp/0")
readers << IndexReader.new("/tmp/1")
readers << IndexReader.new("/tmp/2")
readers << IndexReader.new("/tmp/3")
readers << IndexReader.new("/tmp/4")
index_writer = IndexWriter.new(:path => "/tmp/test")
index_writer.add_readers(readers)
index_writer.close()
readers.each {|reader| reader.close()}
i = Ferret::I.new(:path => ''/tmp/test'')
res = i.search(''name*'')
puts res.inspect # gives me: #<struct Ferret::Search::TopDocs
total_hits=0, hits=[], max_score=0.0,
searcher=#<Ferret::Search::Searcher:0x58a6ec>>

puts res.hits.size # gives me: 0