Commit 931b9c898d66036a64f10025d18bbb0feac60856
1 parent
90a8524c
Exists in
master
and in
21 other branches
Updated readme
Showing
1 changed file
with
9 additions
and
2 deletions
Show diff stats
README.md
@@ -37,16 +37,23 @@ Product.search "Butter", fields: [:name, :brand] | @@ -37,16 +37,23 @@ Product.search "Butter", fields: [:name, :brand] | ||
37 | ### Query Like SQL | 37 | ### Query Like SQL |
38 | 38 | ||
39 | ```ruby | 39 | ```ruby |
40 | -Product.search "2% Milk", where: {in_stock: true}, limit: 10, offset: 50 | 40 | +Product.search "2% Milk", where: {in_stock: true}, limit: 10, offset: 50, order: {name: :desc} |
41 | ``` | 41 | ``` |
42 | 42 | ||
43 | +The default order is `{_score: :desc}` (most relevant first). | ||
44 | + | ||
43 | Additional operators | 45 | Additional operators |
44 | 46 | ||
45 | ```ruby | 47 | ```ruby |
46 | where: { | 48 | where: { |
47 | expires_at: {gt: Time.now}, # lt, gte, lte also available | 49 | expires_at: {gt: Time.now}, # lt, gte, lte also available |
48 | orders_count: 1..10, # equivalent to {gte: 1, lte: 10} | 50 | orders_count: 1..10, # equivalent to {gte: 1, lte: 10} |
49 | - store_id: {not: 2} | 51 | + store_id: {not: 2}, |
52 | + aisle_id: {in: [10, 11]}, | ||
53 | + or: [ | ||
54 | + {in_stock: true}, | ||
55 | + {backordered: true} | ||
56 | + ] | ||
50 | } | 57 | } |
51 | ``` | 58 | ``` |
52 | 59 |