Skip to content

Instantly share code, notes, and snippets.

View AdityaBhutani's full-sized avatar
☀️
Sunny

Aditya Bhutani AdityaBhutani

☀️
Sunny
View GitHub Profile
@JasonTrue
JasonTrue / searchkick_and_elasticsearch_guidance.md
Last active July 17, 2024 10:01
Searchkick and Elastic Search guidance

Resources:

https://github.com/ankane/searchkick

Indexing

By default, simply adding the call 'searchkick' to a model will do an unclever indexing of all fields (but not has_many or belongs_to attributes).

In practice, you'll need to customize what gets indexed. This is done by defining a method on your model called search_data

def search_data

@justinweiss
justinweiss / filterable.rb
Last active August 12, 2024 10:10
Filterable
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with names based on the keys in <tt>filtering_params</tt>
# with their associated values. For example, "{ status: 'delayed' }" would call