** UPDATE** Adding SEARCH functionality to a website

RubyonRails_newbie
Tue, 27 Oct 2009 21:18:46 -0000

Update: I seem to have some success in returning a value in the log,
but it still isn''t  displaying it in the browser..

the log shows

total hits: 2, results delivered: 2

however, why is the data not displaying in the browser?

Here''s how my controller looks so far:


def search

    @title = " Search"
    if params[:q]
    query = params[:q]
    # First find the user hits...

    users = User.find_with_ferret(query, :limit => :all)

  @users = users.collect { |user| info.user }


  end


so the log finds 2 records, but nothing visible to the user.. any
ideas?


On 27 Oct, 20:42, RubyonRails_newbie
<craigwest...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
wrote:
> I have found a log file if it helps...
>
> It doesn''t mean a lot to me though...
>
> Query: username1
> total hits: 0, results delivered: 0
> [user] register class User with index user
> [user] refusing re-registration of class User
> index_for [User(id: integer, username: string, email: string,
> password: string, created_at: datetime, updated_at: datetime,
> authorization_token: string)]
> options: {:page=>nil, :offset=>0, :limit=>:all}
> ar_options: {}
> [user] stored_fields: nil
>
> On 27 Oct, 18:21, RubyonRails_newbie
<craigwest...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
> wrote:
>
>
>
> > Ah actually, in Terminal there is this:
>
> > configured index for class Info:
> > {:ferret_fields=>{"username"=>
> > {:term_vector=>:with_positions_offsets, :boost=>1.0,
:highlight=>:yes, :via=>"username", :store=>:no,
:index=>:yes},
> > "email"=>
> > {:term_vector=>:with_positions_offsets, :boost=>1.0,
:highlight=>:yes, :via=>"email", :store=>:no,
:index=>:yes}}, :user_default_field=>nil, :enabled=>true, :fields=>
> > ["username", "email"],
:index_dir=>"/Users/me/apps/ruby/project_test/
> > index/development/
> > info", :mysql_fast_batches=>true, :single_index=>false,
:index_base_dir=>"/
> > Users/me/apps/ruby/project_test/index/development/
> > info", :name=>:info, :reindex_batch_size=>1000,
:raise_drb_errors=>false, :registered_models=>
> > [Info(id: integer, user_id: integer, first_name: string, last_name:
> > string, gender: string, birthdate: date, city: string, ski_snowboard:
> > string)], :ferret=>{:default_field=>["username",
"email"], :path=>"/
> > Users/me/apps/ruby/project_test/index/development/
> > info", :analyzer=>#<Ferret::Analysis::StandardAnalyzer:
> > 0x26db044>, :lock_retry_time=>2, :auto_flush=>true,
:or_default=>false, :key=>:key, :dir=>#<Ferret::Store::FSDirectory:
> > 0x26c8d04>, :handle_parse_errors=>true,
:create_if_missing=>true}}
>
> > But I don''t get why it isnt returning anything
>
> > On 27 Oct, 16:34, Marnen Laibow-Koser <rails-mailing-l...@andreas-
>
> > s.net> wrote:
> > > RubyonRails_newbie wrote:
> > > > what have I missed?
>
> > > > I''m new to ruby on rails, and followed the tutorial
to set it up..
>
> > > > What other config do I need???
>
> > > How should we know, without any info on what errors
you''re getting?
>
> > > Best,
> > > --
> > > Marnen Laibow-Koserhttp://www.marnen.org
> > > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org
> > > --
> > > Posted viahttp://www.ruby-forum.com/.