README.md in searchjoy-1.0.0 vs README.md in searchjoy-1.1.0

- old
+ new

@@ -5,14 +5,14 @@ [See it in action](https://searchjoy.dokkuapp.com/) [![Screenshot](https://searchjoy.dokkuapp.com/assets/searchjoy-7be12d922ca8b31b7d7440e618b0c666698a4b15752653a0c5c45e3dd2737142.png)](https://searchjoy.dokkuapp.com/) - view searches in real-time -- track conversions week over week +- track conversion rate week over week - monitor the performance of top searches -Works with any search platform, including Elasticsearch, Sphinx, and Solr +Works with any search platform, including Elasticsearch, OpenSearch, Sphinx, and Solr :cupid: An amazing companion to [Searchkick](https://github.com/ankane/searchkick) [![Build Status](https://github.com/ankane/searchjoy/workflows/build/badge.svg?branch=master)](https://github.com/ankane/searchjoy/actions) @@ -120,11 +120,15 @@ ## Data Retention Data should only be retained for as long as it’s needed. Delete older data with: ```ruby -Searchjoy::Search.where("created_at < ?", 1.year.ago).in_batches.delete_all +Searchjoy::Search.where("created_at < ?", 1.year.ago).find_in_batches do |searches| + search_ids = searches.map(&:id) + Searchjoy::Conversion.where(search_id: search_ids).delete_all + Searchjoy::Search.where(id: search_ids).delete_all +end ``` You can use [Rollup](https://github.com/ankane/rollup) to aggregate important data before you do. ```ruby @@ -132,10 +136,13 @@ ``` Delete data for a specific user with: ```ruby -Searchjoy::Search.where(user_id: 1).delete_all +user_id = 123 +search_ids = Searchjoy::Search.where(user_id: user_id).pluck(:id) +Searchjoy::Conversion.where(search_id: search_ids).delete_all +Searchjoy::Search.where(id: search_ids).delete_all ``` ## Customize To customize, create an initializer `config/initializers/searchjoy.rb`.