help me perform my first searchkick search

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

help me perform my first searchkick search

fugee ohu
So far, I don't get any results returned

user.rb:

searchkick  word_middle: ['full_name', 'description', 'interests']

 def full_name
  [first_name, last_name].join(' ')
 end
 
 def search_data
   {
   full_name: full_name,
   description: description,
   interests: interests
   }
 end

world_controller.rb
def search
  @terms=params[:terms]
  search = params[:terms].present? ? params[:terms] : nil
    @users = if search
       User.search(search)
    end
end   

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ec49e885-5b99-41f0-ac42-fa820743064e%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: help me perform my first searchkick search

fugee ohu


On Tuesday, February 4, 2020 at 8:08:17 PM UTC-5, fugee ohu wrote:
So far, I don't get any results returned

user.rb:

searchkick  word_middle: ['full_name', 'description', 'interests']

 def full_name
  [first_name, last_name].join(' ')
 end
 
 def search_data
   {
   full_name: full_name,
   description: description,
   interests: interests
   }
 end

world_controller.rb
def search
  @terms=params[:terms]
  search = params[:terms].present? ? params[:terms] : nil
    @users = if search
       User.search(search)
    end
end   


I solved this by adding User.reindex to my controller action

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c84fa29b-fe84-4424-8f52-1df1c35a8b74%40googlegroups.com.