MultiSearcher Results Question


#1

If searching multiple indexes with a single searcher is there anyway to
identify which index a resulting doc is stored in?

i1 = Ferret::I.new
i2 = Ferret::I.new

i1 << {:id=>1,:text=>“random stuff”}
i1.commit

reader =
Ferret::Index::IndexReader.new([i1.options[:dir],i2.options[:dir]])

searcher = Ferret::Index::IndexSearcher.new(reader)

query = Ferret::Search::MatchAllQuery.new

searcher.search_each(query) do |doc_id,score|
puts reader[doc_id][:text] # Anyway to find what index this doc is
stored in?
end


#2

On Wed, May 02, 2007 at 05:22:05PM +0200, Dan Reverri wrote:

Ferret::Index::IndexReader.new([i1.options[:dir],i2.options[:dir]])

searcher = Ferret::Index::IndexSearcher.new(reader)

query = Ferret::Search::MatchAllQuery.new

searcher.search_each(query) do |doc_id,score|
puts reader[doc_id][:text] # Anyway to find what index this doc is
stored in?
end

I don’t think so. I think I would store a flag indicating which index
the doc is in at indexing time with each doc.

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
removed_email_address@domain.invalid | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa