Forum: Ferret MultiSearcher Results Question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
49541ef12b1f1ec82cd53764f11ed18a?d=identicon&s=25 Dan Reverri (Guest)
on 2007-05-02 17:22
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
C9dd93aa135988cabf9183d3210665ca?d=identicon&s=25 Jens Kraemer (Guest)
on 2007-05-03 10:05
(Received via mailing list)
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
kraemer@webit.de | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
This topic is locked and can not be replied to.