Commit 6c1ac53afd51ecbd1c7ce334bd013fc8a3560269
1 parent
6c14cb6a
Exists in
master
and in
2 other branches
Updated readme for lazy loading [skip ci]
Showing
1 changed file
with
4 additions
and
13 deletions
Show diff stats
README.md
... | ... | @@ -1688,8 +1688,8 @@ Searchkick.client |
1688 | 1688 | To batch search requests for performance, use: |
1689 | 1689 | |
1690 | 1690 | ```ruby |
1691 | -products = Product.search("snacks", execute: false) | |
1692 | -coupons = Coupon.search("snacks", execute: false) | |
1691 | +products = Product.search("snacks") | |
1692 | +coupons = Coupon.search("snacks") | |
1693 | 1693 | Searchkick.multi_search([products, coupons]) |
1694 | 1694 | ``` |
1695 | 1695 | |
... | ... | @@ -1963,13 +1963,6 @@ class Product < ApplicationRecord |
1963 | 1963 | end |
1964 | 1964 | ``` |
1965 | 1965 | |
1966 | -Lazy searching | |
1967 | - | |
1968 | -```ruby | |
1969 | -products = Product.search("carrots", execute: false) | |
1970 | -products.each { ... } # search not executed until here | |
1971 | -``` | |
1972 | - | |
1973 | 1966 | Add [request parameters](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html#search-search-api-query-params) like `search_type` |
1974 | 1967 | |
1975 | 1968 | ```ruby |
... | ... | @@ -2057,12 +2050,10 @@ Also, searches now use lazy loading: |
2057 | 2050 | |
2058 | 2051 | ```ruby |
2059 | 2052 | # search not executed |
2060 | -products = Product.search("milk") | |
2053 | +Product.search("milk") | |
2061 | 2054 | |
2062 | 2055 | # search executed |
2063 | -products.each do |product| | |
2064 | - # ... | |
2065 | -end | |
2056 | +Product.search("milk").to_a | |
2066 | 2057 | ``` |
2067 | 2058 | |
2068 | 2059 | Check out the [changelog](https://github.com/ankane/searchkick/blob/master/CHANGELOG.md) for the full list of changes. | ... | ... |