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:
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?