Commit c52dbd0fb1b0a9c6c7e1c33de13af5ec512c7b38

Authored by Andrew Kane
1 parent b0994f0c

Added intelligent search section [skip ci]

Showing 1 changed file with 11 additions and 8 deletions   Show diff stats
@@ -33,6 +33,7 @@ Plus: @@ -33,6 +33,7 @@ Plus:
33 - [Getting Started](#getting-started) 33 - [Getting Started](#getting-started)
34 - [Querying](#querying) 34 - [Querying](#querying)
35 - [Indexing](#indexing) 35 - [Indexing](#indexing)
  36 +- [Intelligent Search](#intelligent-search)
36 - [Instant Search / Autocomplete](#instant-search--autocomplete) 37 - [Instant Search / Autocomplete](#instant-search--autocomplete)
37 - [Aggregations](#aggregations) 38 - [Aggregations](#aggregations)
38 - [Deployment](#deployment) 39 - [Deployment](#deployment)
@@ -587,6 +588,8 @@ class Image < ApplicationRecord @@ -587,6 +588,8 @@ class Image < ApplicationRecord
587 end 588 end
588 ``` 589 ```
589 590
  591 +## Intelligent Search
  592 +
590 ### Analytics 593 ### Analytics
591 594
592 The best starting point to improve your search **by far** is to track searches and conversions. 595 The best starting point to improve your search **by far** is to track searches and conversions.
@@ -604,7 +607,7 @@ Focus on: @@ -604,7 +607,7 @@ Focus on:
604 - top searches with low conversions 607 - top searches with low conversions
605 - top searches with no results 608 - top searches with no results
606 609
607 -### Keep Getting Better 610 +### Conversions
608 611
609 Searchkick can use conversion data to learn what users are looking for. If a user searches for “ice cream” and adds Ben & Jerry’s Chunky Monkey to the cart (our conversion metric at Instacart), that item gets a little more weight for similar searches. 612 Searchkick can use conversion data to learn what users are looking for. If a user searches for “ice cream” and adds Ben & Jerry’s Chunky Monkey to the cart (our conversion metric at Instacart), that item gets a little more weight for similar searches.
610 613
@@ -638,7 +641,7 @@ rake searchkick:reindex CLASS=Product @@ -638,7 +641,7 @@ rake searchkick:reindex CLASS=Product
638 641
639 **Note:** For a more performant (but more advanced) approach, check out [performant conversions](#performant-conversions). 642 **Note:** For a more performant (but more advanced) approach, check out [performant conversions](#performant-conversions).
640 643
641 -### Personalized Results 644 +## Personalized Results
642 645
643 Order results differently for each user. For example, show a user’s previously purchased products before other results. 646 Order results differently for each user. For example, show a user’s previously purchased products before other results.
644 647
@@ -659,7 +662,7 @@ Reindex and search with: @@ -659,7 +662,7 @@ Reindex and search with:
659 Product.search "milk", boost_where: {orderer_ids: current_user.id} 662 Product.search "milk", boost_where: {orderer_ids: current_user.id}
660 ``` 663 ```
661 664
662 -### Instant Search / Autocomplete 665 +## Instant Search / Autocomplete
663 666
664 Autocomplete predicts what a user will type, making the search experience faster and easier. 667 Autocomplete predicts what a user will type, making the search experience faster and easier.
665 668
@@ -727,7 +730,7 @@ Then add the search box and JavaScript code to a view. @@ -727,7 +730,7 @@ Then add the search box and JavaScript code to a view.
727 </script> 730 </script>
728 ``` 731 ```
729 732
730 -### Suggestions 733 +## Suggestions
731 734
732 ![Suggest](https://gist.github.com/ankane/b6988db2802aca68a589b31e41b44195/raw/40febe948427e5bc53ec4e5dc248822855fef76f/recursion.png) 735 ![Suggest](https://gist.github.com/ankane/b6988db2802aca68a589b31e41b44195/raw/40febe948427e5bc53ec4e5dc248822855fef76f/recursion.png)
733 736
@@ -744,7 +747,7 @@ products = Product.search &quot;peantu butta&quot;, suggest: true @@ -744,7 +747,7 @@ products = Product.search &quot;peantu butta&quot;, suggest: true
744 products.suggestions # ["peanut butter"] 747 products.suggestions # ["peanut butter"]
745 ``` 748 ```
746 749
747 -### Aggregations 750 +## Aggregations
748 751
749 [Aggregations](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html) provide aggregated search data. 752 [Aggregations](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html) provide aggregated search data.
750 753
@@ -820,7 +823,7 @@ For other aggregation types, including sub-aggregations, use `body_options`: @@ -820,7 +823,7 @@ For other aggregation types, including sub-aggregations, use `body_options`:
820 Product.search "orange", body_options: {aggs: {price: {histogram: {field: :price, interval: 10}}} 823 Product.search "orange", body_options: {aggs: {price: {histogram: {field: :price, interval: 10}}}
821 ``` 824 ```
822 825
823 -### Highlight 826 +## Highlight
824 827
825 Specify which fields to index with highlighting. 828 Specify which fields to index with highlighting.
826 829
@@ -873,7 +876,7 @@ Band.search &quot;cinema&quot;, fields: [:name], highlight: {fields: {name: {fragment_size @@ -873,7 +876,7 @@ Band.search &quot;cinema&quot;, fields: [:name], highlight: {fields: {name: {fragment_size
873 876
874 You can find available highlight options in the [Elasticsearch reference](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html#_highlighted_fragments). 877 You can find available highlight options in the [Elasticsearch reference](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html#_highlighted_fragments).
875 878
876 -### Similar Items 879 +## Similar Items
877 880
878 Find similar items. 881 Find similar items.
879 882
@@ -882,7 +885,7 @@ product = Product.first @@ -882,7 +885,7 @@ product = Product.first
882 product.similar(fields: [:name], where: {size: "12 oz"}) 885 product.similar(fields: [:name], where: {size: "12 oz"})
883 ``` 886 ```
884 887
885 -### Geospatial Searches 888 +## Geospatial Searches
886 889
887 ```ruby 890 ```ruby
888 class Restaurant < ApplicationRecord 891 class Restaurant < ApplicationRecord