Skip to content

Easily query elasticsearch given a client-side payload

License

Notifications You must be signed in to change notification settings

richmolj/trample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Lee Richmond
Nov 7, 2016
7373ac9 · Nov 7, 2016

History

84 Commits
Oct 28, 2015
Nov 7, 2016
Nov 7, 2016
Aug 31, 2016
Oct 28, 2015
Sep 16, 2016
Jul 27, 2016
Aug 31, 2016
Oct 28, 2015
Sep 20, 2016
Oct 28, 2015
Aug 31, 2016

Repository files navigation

Trample

Build Status

Additional querying sugar for searchkick.

Why Trample?

Searchkick provides a nice query mechanism. But it doesn't provide a way to build up those queries, particularly syncing with UI input. Trample makes this simple:

class PeopleSearchesController < ApplicationController

  def update
    search = PeopleSearch.new(params[:people_search)
    search.query!
    
    render json: search
  end

end

Or, build up queries manually:

search = PeopleSearch.new
search.condition(:security_level).in(%w(low medium)) unless current_user.admin?
search.paginate(size: 10, number: 2).sort("-age")
search.query!
search.results

Install

$ gem install trample_search

or

gem 'trample_search'

Usage

Check out the complete documentation, or see usage in the specs.

Specs

Run elasticsearch on port 9250 and bundle exec rspec.

Contributing

  1. Fork it ( https://github.com/fotinakis/swagger-blocks/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request