Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

searchjoy

> 编程语言
Open source

Search analytics made easy

665 stars0 likes1 views
WebsiteGitHub

About

Search analytics made easy

Searchjoy

Search analytics made easy

See it in action

  • view searches in real-time
  • track conversion rate week over week
  • monitor the performance of top searches

Works with any search platform, including Elasticsearch, OpenSearch, Sphinx, and Solr

:cupid: An amazing companion to Searchkick

Installation

Add this line to your application’s Gemfile:

ruby
gem "searchjoy"

And run the generator. This creates a migration to store searches.

bash
rails generate searchjoy:install
rails db:migrate

Next, add the dashboard to your config/routes.rb.

ruby
mount Searchjoy::Engine, at: "searchjoy"

Be sure to protect the endpoint in production - see the Authentication section for ways to do this.

Track Searches

Track searches by creating a record in the database.

ruby
Searchjoy::Search.create(
  search_type: "Item", # typically the model name
  query: "apple",
  results_count: 12,
  user_id: 1
)

With Searchkick, you can use the track option to do this automatically.

ruby
Item.search("apple", track: {user_id: 1})

If you want to track more attributes, add them to the searchjoy_searches table.

ruby
add_column :searchjoy_searches, :source, :string

Then, pass the values to the track option.

ruby
Item.search("apple", track: {user_id: 1, source: "web"})

Track Conversions

First, choose a conversion metric. At Instacart, an item added to the cart from the search results page counts as a conversion.

Next, when a user searches, keep track of the search id. With Searchkick, you can get the id with:

ruby
results = Item.search("apple", track: true)
results.search.id

When a user converts, find the record and call convert.

ruby
search = Searchjoy::Search.find(params[:id])
search.convert

Better yet, record the model that converted.

ruby
search.convert(item)

Authentication

Don’t forget to protect the dashboard in production.

Devise

In your config/routes.rb:

ruby
authenticate :user, ->(user) { user.admin? } do
  mount Searchjoy::Engine, at: "searchjoy"
end

Basic Authentication

Set the following variables in your environment or an initializer.

ruby
ENV["SEARCHJOY_USERNAME"] = "andrew"
ENV["SEARCHJOY_PASSWORD"] = "secret"

Data Retention

Data should only be retained for as long as it’s needed. Delete older data with:

ruby
Searchjoy::Search.where("created_at (search) { Rails.application.routes.url_helpers.items_path(q: search.query) }

Add additional info to the query in the live stream

ruby
Searchjoy.query_name = ->(search) { "#{search.query} #{search.city}" }

Show the conversion name in the live stream

ruby
Searchjoy.conversion_name = ->(model) { model.name }

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

  • Report bugs
  • Fix bugs and submit pull requests
  • Write, clarify, or fix documentation
  • Suggest or add new feature

To get started with development and testing:

bash
git clone https://github.com/ankane/searchjoy.git
cd searchjoy
bundle install
bundle exec rake test

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言