Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Clement ROULLET's Profile

GitHub User: Cl3MM

Comments by Clement ROULLET

Avatar

For those of you having troubles when using routes containing subdomains in combination with Nginx (v1.2.5), you have to modify Ryan's Nginx configuration file like so:

Change this:

ruby
location @unicorn {
  #...
  proxy_set_header Host $http_host;
  #...
}

To this:

ruby
location @unicorn {
  #...
  proxy_set_header Host $host;
  #...
}

Restart, and you should be good to go!

The $http_host variable seems to only return the request subdomain.

Avatar

I'm answering to my own question: just use the total attribute on the search result:

ruby
@articles = Article.search(params)
@total_articles = @articles.total

Thanks again for the great screencasts !

Avatar

Hey all !

I've been struggling for a few days, first installing ES as a service (the 0.19.6.deb wouldn't work on both LMDE and Ubuntu server 12.04), and then displaying results with pagination (I found the ES website quite outdated).

Anyway, I though I should share my small findings:

First for those of you who want to run ES as a service, you should check the service wrapper once you have compiled and installed ES. Then follow the documentation to run it as a non root user

Moreover, my queries didn't return more than 10 results at a time. I fixed this adding a match_all:{} parameter in the tire.search function :

ruby
def self.search(params)
  tire.search(load: true, match_all: {}, ... ) do
  # ...
end

I also have a question: how can I retrieve the number of hits return by query when using pagination?

Thanks again Ryan for your amazing screencasts !

Update: the newly released version 0.19.7 of the deb package fix the installation issue