Forum: Ferret stack level too deep

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Raghuveer M. (Guest)
on 2006-06-06 21:04
Iam new to ferret Iam trying to do a sample application on ferret
this is my code:

class SearchController < ApplicationController
require 'ferret'
include Ferret

  index = => '/path/to/index')
  def list

  def index

    index << {:title => "Programming Ruby", :content => "blah blah
    index << {:title => "Programming Ruby", :content => "yada yada
     count=index.search_each('content:"blah"') do |doc, score|
        puts "Document #{doc} found with a score of #{score}"
     puts count



This is wht i ended up with:


SystemStackError in SearchController#index
stack level too deep
RAILS_ROOT: ./script/../config/..

Application Trace | Framework Trace | Full Trace
#{RAILS_ROOT}/app/controllers/search_controller.rb:11:in `index'
#{RAILS_ROOT}/app/controllers/search_controller.rb:11:in `index'

Reply please if some one know the answer
Matthew S. (Guest)
on 2006-06-06 23:30
(Received via mailing list)
On Jun 6, 2006, at 18:04, Raghuveer Mamilla wrote:

>   def index
>     index << ...

I haven't tried it out, but I believe that ruby is interpreting this
as a recursive call to the index method.  At least, that's what
usually creates that sort of error.

I'm not altogether familiar with rails conventions, but in the
general case I would either make 'index' a class (@@index) or
instance (@index) variable, which would avoid this problem.  Is there
some reason it's declared as local?

matthew smillie.
This topic is locked and can not be replied to.