Advanced Search, Autocomplete and Suggestions with ElasticSearch and the Searchkick gem Discussion
Chris, this is awesome!
I was hoping you'd do a Searchkick/ElasticSearch video since you did the Ransack video!
Thanks for all the great videos!
Thanks Chris – another great tutorial!
What about if you want to search through more than 1 items, with a separate MVC.
Say you have Questions and Answers. I tried modifying the search form but it seems
there are lot more areas to look at.
can you share your experience , searching multiple models in one query please , i can't get it to work
Thanks for your this great video @excid3:disqus . I advise people to use Algolia if they want to use a database search https://blog.algolia.com/fu...
Hello Chris....
If I have many models and I want a common search that works for all the models and gives results from all models in common search result page then how is this possible?
You'll either need to do separate searches and combine the results or index one main model and include the nested models attributes in the index.
Thanks for the tutorial. I tried to install elasticsearch but i get an error. I explained the full error in this post http://goo.gl/cqVFyl in stackoverflow.
Hello Chris, I included elastic-search as you explained in the tutorial... working perfectly on local... but when I put on digitalocean server, they blocked my droplet that network is not secure with process of elastic search and If I get it stop and secure it then will open... How I can secure the elastic search for production server?
I have just finished the One Month class on RAILS and checked into this. (which is obviously a bit more advanced). How does one generate a Questions controller or does that arrive when you bundle instal the search gem?
You can generate a scaffold for it just like you did with the posts in the Rails class. You'll possibly want different fields, but you can create it the same way.
Is anyone else having this problem? http://stackoverflow.com/qu...
I've been trying to install elastic search but ran into some issues with homebrew and java. I recently upgraded to Yosemti and it seems to be the issue. Anyone know of a fix
I am trying to follow along with this but I get this error when I try Article.reindex (equivalent of Question.reindex)
NoMethodError: undefined method `reindex'
In the console, I try: Article.reindex
It returns:
NoMethodError: undefined method `reindex' for Article (call 'Article.connection' to establish a connection):Class
Also, when I try to run the local host, I get this error:
Index missing - run Article.reindex
# GET /articles.json
def index
@articles = Article.search(params[:q])
end
# GET /articles/1
For me:
def index
query = params[:q].presence || "*"
@articles = Article.search(query)
end
gives this error:
MissingIndexError in ArticlesController#index
Index missing - run Article.reindex
My key difference is that:
I use simple form for forms, so i made a new partial to insert in my articles index as:
<%= simple_form_for(@article) do |f| %>
<%=f.text :q, :nil, placeholder: "Search" %>
<% end %>
TOTAL NUMPTY: I DIDN'T INSTALL THE GEM. SORRY!
How would I search a Post model where I wanted only see published post? Can't figure out how the code should look in the controller index.
You can actually just add that into your query. For example, if your published column was a boolean: Post.search('*',where:{published:true})
How can I add 'will paginate' to the search results... in class PostsController < ApplicationController?
I currently have this;
if query = params[:post_search].presence || "*"
@posts = Post.search(query, suggest: true)
Thanks for the video Chris. I am having issues with the autocomplete part. I have jquery-ui loaded and everything done up to the point where I try to test the libraries are loading (up to 17:32mins into the video. My first autocomplete test does not show anything (was expecting the word TEST would show as in your case). When I inspect the element, I see the following error:
Failed to load resource: the server responded with a status of 404 (Not Found) - https://bakr-fgneba.c9users...
When i click on the link i see the error (Couldn't find Post with 'id'=autocomplete). Looks like something to do with routing.
My route is defined as:
resources :posts do
get :autocomplete
end
Any idea why this could be happening?
Hi Chris, i've tried using Bonsai and SearchBox for deploying to Heroku and both are a nightmare to get working. Do you have any recommendations on deploying to Heroku?
It should just pick up the searchbox ENV variable and work. Depending on how many models you're indexing, you'll need the correct number of shards available (some of the ES options limit shards or other things).
Hi Chris!
I love the videos! I've been stuck on this problem for a while and tried StackOverflow(http://stackoverflow.com/qu... but with no response and I know you're busy but I thought I'd try.
I have forums(the parent model) that have many forum_threads but each forum_thread is unique to that certain forum. I'd like to be able to search each forum (which IS working just fine) as well as each forum_thread within that unique forum(which is just rendering ALL forum_threads rather than the searched thread). Would you be so kind as to take a look at my SO question and see what I'm doing wrong?