Commit dca8d4c2f224eddd40089c6f5c193df15902207c
1 parent
2e021f9e
Exists in
master
and in
1 other branch
Added note about BigDecimals - closes #1538
Showing
1 changed file
with
12 additions
and
0 deletions
Show diff stats
README.md
... | ... | @@ -2063,6 +2063,18 @@ Product.search("api", misspellings: {prefix_length: 2}) # api, apt, no ahi |
2063 | 2063 | Product.search("ah", misspellings: {prefix_length: 2}) # ah, no aha |
2064 | 2064 | ``` |
2065 | 2065 | |
2066 | +BigDecimal values are indexed as floats by default so they can be used for boosting. Convert them to strings to keep full precision. | |
2067 | + | |
2068 | +```ruby | |
2069 | +class Product < ApplicationRecord | |
2070 | + def search_data | |
2071 | + { | |
2072 | + units: units.to_s("F") | |
2073 | + } | |
2074 | + end | |
2075 | +end | |
2076 | +``` | |
2077 | + | |
2066 | 2078 | ## Gotchas |
2067 | 2079 | |
2068 | 2080 | ### Consistency | ... | ... |