Searcher Explain

Hi,

I am unable to use the Searcher’s explain method. Anytime I call it, I
get
Segmentation Faults and it kills the process I have running my Rails
site.
Has anyone else had this problem? Here is some code I am trying to use
it
in…

search = Search.create(:query => query)

@quotations = []

searcher = Ferret::Search::Searcher.new(“index”) # FerretConfig::INDEX

bq = self.build_query(query) # Builds a Boolean Query

searcher.search_each(bq) {|doc, score|
@quotations << SearchResult.new(searcher[doc][:id],
searcher[doc][:quotation], searcher[doc][:author], score)
}

p searcher.explain(bq, @quotations[0].id).to_s

searcher.close

Thanks in advance for any help!

-James

Hi!

On Fri, May 09, 2008 at 10:49:47AM -0400, James Harvey wrote:

bq = self.build_query(query) # Builds a Boolean Query

searcher.search_each(bq) {|doc, score|
@quotations << SearchResult.new(searcher[doc][:id],
searcher[doc][:quotation], searcher[doc][:author], score)
}

p searcher.explain(bq, @quotations[0].id).to_s

If I get this right, @quotations[0].id will give the value of the id
field of that result, which is not a valid argument to explain. What the
explain method expects instead is the ferret-internal document id (the
doc value in your search_each block).

cheers,
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
[email protected] | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs