ruby on rails - Why is sunspot returning all results when I provide a particular param? -


i following: railscasts 278 , have following:

 def search      if params[:search] == ''       @search_results = []     else       @search = challenge.search         fulltext params[:search]       end       @search_results = @search.result     end   end 

model

 searchable      text :title, :location, :boost => 5     text :location     time :created_at     string :most_participated   end    def most_participated     participation.group('challenge_id').order('count(challenge_id) desc')   end  

my issue when search particular returned records. logs provided here:

started "/search?utf8=%e2%9c%93&search=test" 127.0.0.1 @ 2015-05-14 21:39:15 +0100 processing challengescontroller#search html parameters: {"utf8"=>"✓", "search"=>"test"} user load (0.4ms) select users.* users users.id = 2 order users.id asc limit 1 challenge load (0.6ms) select challenges.* challenges rendered challenges/search.html.erb within layouts/application (10.6ms)

update

anyone stuck this. not classname.search unknown reason doesn't work. did sunspot.search(user) do ... railscast outdated


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -