Hi all,
I’m trying to implement search features in my application.I’m using
act_as_ferret plugins. But i’m facing some problems. The problem is ,
I am not able to display the search results in the get_results.rhtml
page. Also, once the index is built and I dont delete the previous
one, it throws the following error:
NoMethodError in Search#get_results
Showing app/views/search/get_results.rhtml where line #5 raised:
undefined method `field’ for {}:Ferret::Index::LazyDoc
Extracted source (around line #5):
2:
3: <% for result in @results -%>
4:
5:
6: <%= result.field(‘title’).string_value %></
strong>
7: <%=
highlight(result.field(‘teaser’).string_value,
@search_term) %>
8:
RAILS_ROOT: C:/INSTAN~1.7-W/INSTAN~1/rails_apps/ferret_test/config/…
Application Trace | Framework Trace | Full Trace
#{RAILS_ROOT}/app/views/search/get_results.rhtml:5:in
_run_rhtml_47app47views47search47get_results46rhtml' #{RAILS_ROOT}/app/views/search/get_results.rhtml:3:in
each’
#{RAILS_ROOT}/app/views/search/get_results.rhtml:3:in
`_run_rhtml_47app47views47search47get_results46rhtml’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_view/base.rb:326:in send' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_view/base.rb:326:in
compile_and_render_template’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_view/base.rb:301:in render_template' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_view/base.rb:260:in
render_file’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/base.rb:806:in render_file' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/base.rb:711:in
render_with_no_layout’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/layout.rb:256:in render_without_benchmark' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/benchmarking.rb:50:in
render’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in
measure' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/benchmarking.rb:50:in
render’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/base.rb:1096:in perform_action_without_filters' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/filters.rb:632:in
call_filter’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/filters.rb:619:in
perform_action_without_benchmark' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/benchmarking.rb:66:in
perform_action_without_rescue’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in
measure' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/benchmarking.rb:66:in
perform_action_without_rescue’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/rescue.rb:83:in perform_action' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/base.rb:430:in
send’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/base.rb:430:in process_without_filters' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/filters.rb:624:in
process_without_session_management_support’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/session_management.rb:114:in process' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/base.rb:330:in
process’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/
dispatcher.rb:41:in dispatch' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel/rails.rb:78:in
process’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel/rails.rb:76:in synchronize' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel/rails.rb:76:in
process’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel.rb:618:in process_client' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel.rb:617:in
each’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel.rb:617:in process_client' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel.rb:736:in
run’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel.rb:736:in initialize' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel.rb:736:in
new’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel.rb:736:in run' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel.rb:720:in
initialize’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel.rb:720:in new' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel.rb:720:in
run’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel/configurator.rb:271:in run' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel/configurator.rb:270:in
each’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel/configurator.rb:270:in run' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/bin/mongrel_rails:127:in
run’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel/command.rb:211:in run' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/bin/mongrel_rails:243 C:/INSTAN~1.7-W/INSTAN~1/ruby/bin/mongrel_rails:16:in
load’
C:/INSTAN~1.7-W/INSTAN~1/ruby/bin/mongrel_rails:16
#{RAILS_ROOT}/app/views/search/get_results.rhtml:5:in
_run_rhtml_47app47views47search47get_results46rhtml' #{RAILS_ROOT}/app/views/search/get_results.rhtml:3:in
each’
#{RAILS_ROOT}/app/views/search/get_results.rhtml:3:in
_run_rhtml_47app47views47search47get_results46rhtml' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_view/base.rb:326:in
send’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_view/base.rb:326:in compile_and_render_template' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_view/base.rb:301:in
render_template’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_view/base.rb:260:in render_file' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/base.rb:806:in
render_file’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/base.rb:711:in render_with_no_layout' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/layout.rb:256:in
render_without_benchmark’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/benchmarking.rb:50:in render' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in
measure’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/benchmarking.rb:50:in render' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/base.rb:1096:in
perform_action_without_filters’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/filters.rb:632:in call_filter' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/filters.rb:619:in
perform_action_without_benchmark’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/benchmarking.rb:66:in
perform_action_without_rescue' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in
measure’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/benchmarking.rb:66:in
perform_action_without_rescue' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/rescue.rb:83:in
perform_action’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/base.rb:430:in send' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/base.rb:430:in
process_without_filters’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/filters.rb:624:in
process_without_session_management_support' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.3/ lib/action_controller/session_management.rb:114:in
process’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-1.13.3/
lib/action_controller/base.rb:330:in process' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/ dispatcher.rb:41:in
dispatch’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel/rails.rb:78:in process' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel/rails.rb:76:in
synchronize’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel/rails.rb:76:in process' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel.rb:618:in
process_client’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel.rb:617:in each' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel.rb:617:in
process_client’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel.rb:736:in run' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel.rb:736:in
initialize’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel.rb:736:in new' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel.rb:736:in
run’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel.rb:720:in initialize' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel.rb:720:in
new’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel.rb:720:in run' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel/configurator.rb:271:in
run’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/lib/mongrel/configurator.rb:270:in each' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel/configurator.rb:270:in
run’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/bin/mongrel_rails:127:in run' C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1- mswin32/lib/mongrel/command.rb:211:in
run’
C:/INSTAN~1.7-W/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-
mswin32/bin/mongrel_rails:243
C:/INSTAN~1.7-W/INSTAN~1/ruby/bin/mongrel_rails:16:in `load’
C:/INSTAN~1.7-W/INSTAN~1/ruby/bin/mongrel_rails:16
Request
Parameters: {“search”=>{“search_term”=>“ajax”}, “commit”=>“Search”}
Show session dump
flash: !map:ActionController::Flash::FlashHash {}
Response
Headers: {“cookie”=>[], “Cache-Control”=>“no-cache”}