On Thu, Jun 29, 2006 at 04:00:14PM +0200, Charlie wrote:
> The acts_as_ferret documentation says find_by_content returns an 
> instance of SearchResults, but I see this error when I try to use the 
> results.
> 
> undefined method `total_hits' for []:Array
> 
> Here is the link to the documentation:
> 
> http://projects.jkraemer.net/acts_as_ferret/rdoc/classes/FerretMixin/Acts/ARFerret/ClassMethods.html#M000010
> 
> But here is the actual code:
> 
>             result = []
>             hits = index_searcher.search(query, options)
>             hits.each do |hit, score|
>               id = index_searcher.reader.get_document(hit)[:id]
>               begin
>                 res = self.find(id)
>                 result << res if res
>                 logger.debug "result id: #{id}, result: #{res}"
>               rescue
>                 logger.debug "no data for id #{id}"
>               end
>             end
>             return result
> 
> What's wrong?  Do I need another version of the plugin?

yes, this feature is only in svn trunk at this time. The API docs are
generated from trunk automatically, maybe we should fix this and keep
the docs for each version we release.


Jens


-- 
webit! Gesellschaft für neue Medien mbH          www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer       [EMAIL PROTECTED]
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to