Rails and elasticsearch for beginners - follow up

An article, posted more than 8 years ago filed in elasticsearch, rails, search, linux, server, development, ruby, gem, tech & programming.

In a previous post I described how simple integrating elasticsearch is with Rails for beginners. You could've been happy with the fact that you now have implemented full text search, but that too basic set up probably doesn't work that much better than adding a column to your model, throwing in all text in it and running a LIKE query (although elasticsearch does try to rearrange the results a bit).

In this post I will learn you two things that makes elasticsearch worth it.

Analyzers

Analyzers add some fuzziness to your searches. First, make sure your analyzer is in the right language, this will improve your results. You add the following bit to your model (I typically place it just below where the scopes and validation are defined).

settings index: { number_of_shards: 1 } do
  ...

Continue reading...

Rails and elasticsearch for beginners

An article, posted more than 8 years ago filed in elasticsearch, rails, search, linux, server, development, ruby, gem, tech & programming.

I don't like complexity. Adding new items to your stack increases complexity. But sometimes it is worth it. When you need proper search and filtering, elasticsearch is worth it. Mostly because it isn't hard to set up at all, as you'll learn in this post.

Installing it on a Debian server is easy, simply follow their instructions (you'll add their package-server, and run apt-get install. On OS-X you can install it easily with HomeBrew (brew install elasticsearch), but do make sure you have installed a JDK (e.g. openjdk-8-jre-headless)

If you're not using something like Docker, you probably have to repeat the steps on your dev machine, your staging server and your production environment.

Note: When running on a low memory server, which isn't recommended for production, you should make sure that the configured heap size isn't too high, edit `/et…

Continue reading...

[Project] Introducing PortableRails3

An article, posted almost 13 years ago filed in ruby, rails, software, tools, portablerails, installation, github, project & tech.

The InstantRails project is outdated and contains just too much IMHO ( Apache, PHP, who needs that when searching for Rails?). Other options to get Rails running require an installer (RailsInstaller or RubyInstaller )… and in some environments ( limited access accounts ) installing is not an option. And in yet other environments, you'd, well I'd, rather have a command line option, instead of an in-your-face installer that requires end-users to press 'next', 'next', 'next'…So that's why I created Portable Rails 3. It's name was 'inspired' (it's a boring name, I know) by the thoughtfully named Portable Git which makes an excelent companion.Installing is as simple as extracting (or cloning) and running start-cmd.batCreditsI didn't do much besides just throwing the binary stuff together. Stuff that went into the mix (I'll update when I feel its necessary):Ruby 1.9.2PDCurses [1]GDBM  [1]OpenSSL [1]readline [1]Zlib  [1]IconV [1]RubyGems 1.7.2 (updated with update –system )R…

Continue reading...

murb blog