Commit b5f1e04b938488b4b6b6362ecaa6b9e88b08c2cc
1 parent
a4fa4497
Exists in
master
and in
21 other branches
Added section about facets stats in README
Showing
1 changed file
with
8 additions
and
0 deletions
Show diff stats
README.md
@@ -441,6 +441,14 @@ price_ranges = [{to: 20}, {from: 20, to: 50}, {from: 50}] | @@ -441,6 +441,14 @@ price_ranges = [{to: 20}, {from: 20, to: 50}, {from: 50}] | ||
441 | Product.search "*", facets: {price: {ranges: price_ranges}} | 441 | Product.search "*", facets: {price: {ranges: price_ranges}} |
442 | ``` | 442 | ``` |
443 | 443 | ||
444 | + | ||
445 | +#### Stats | ||
446 | +If stats is enabled the facets returned will in addition to the term and a count contain `max`, `min`, `mean` and `total` fields for the score in each facet. This is very useful if you want to be able to sort facets on relevance rather than count. | ||
447 | + | ||
448 | +```ruby | ||
449 | +Product.search "*", facets: {store_id: { stats: true }} | ||
450 | +``` | ||
451 | + | ||
444 | ### Highlight | 452 | ### Highlight |
445 | 453 | ||
446 | Highlight the search query in the results. | 454 | Highlight the search query in the results. |