Commit 86471441947a413f070c91ad03b889300886e250
1 parent
f3c000b1
Exists in
master
and in
21 other branches
Better routing example
Showing
1 changed file
with
3 additions
and
3 deletions
Show diff stats
README.md
@@ -834,11 +834,11 @@ City.search "san", boost_by_distance: {field: :location, origin: {lat: 37, lon: | @@ -834,11 +834,11 @@ City.search "san", boost_by_distance: {field: :location, origin: {lat: 37, lon: | ||
834 | Searchkick supports [Elasticsearch’s routing feature](https://www.elastic.co/blog/customizing-your-document-routing). | 834 | Searchkick supports [Elasticsearch’s routing feature](https://www.elastic.co/blog/customizing-your-document-routing). |
835 | 835 | ||
836 | ```ruby | 836 | ```ruby |
837 | -class Contact < ActiveRecord::Base | 837 | +class Business < ActiveRecord::Base |
838 | searchkick routing: true | 838 | searchkick routing: true |
839 | 839 | ||
840 | def searchkick_routing | 840 | def searchkick_routing |
841 | - user_id | 841 | + city_id |
842 | end | 842 | end |
843 | end | 843 | end |
844 | ``` | 844 | ``` |
@@ -846,7 +846,7 @@ end | @@ -846,7 +846,7 @@ end | ||
846 | Reindex and search with: | 846 | Reindex and search with: |
847 | 847 | ||
848 | ```ruby | 848 | ```ruby |
849 | -Contact.search "John", routing: current_user.id | 849 | +Business.search "ice cream", routing: params[:city_id] |
850 | ``` | 850 | ``` |
851 | 851 | ||
852 | ## Inheritance | 852 | ## Inheritance |