Searchlogic plugin: ActiveRecord search on Steroids

Searchlogic is everything you would ever wish from AR search and you could not find.

The brilliant ideea is that the search itself is seen as an object, so you can add/remove conditions very easy.

search = User.new_search
search.conditions.hour_of_created_at = 5

Another really useful thing is the support for relationships: = "Name"

Other good features are group support

  search = User.new_search
  search.id_gt = 2
  group1 =
  group1.first_name_like = "Ben"
  group2 =
  group2.last_name_like = "Johnson"
  group21 =
  group21.email_ends_with = ""

pagination support

search.per_page = 20 = 3

and startst_with/ends_with/contains/sounds_like etc. column conditions:

search.conditions.email_ends_with = ""
search.conditions.created_after =
group2.last_name_like = "Johnson"

A feature that may be used on ‘fuzzy’ searches is the support for OR between conditions (instead of default AND)

@search.conditions.any = true

It is now available as a gem so you should only

sudo gem install searchlogic

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: