dynamic_sunspot_search 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/lib/dynamic_sunspot_search/translator/boost_recency.rb +1 -1
- data/lib/dynamic_sunspot_search/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 565d7796a1d315c414378899d093e4deb545758f
|
4
|
+
data.tar.gz: f5ebdd130d46165a6c96e490ef352bf4cfd93058
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15585431f73d0f3412855a3c27a8100881e7a7ee51da91e44f6ff36887b50c49c3a8954cc3c514274bdef7b87153e61eac6dfb67308324b74cfa0bb93a5a9c90
|
7
|
+
data.tar.gz: 8b7af8c62c9b3dcc30337484a123c1a0458bf1b279208eb96e7e05afecc1eb091701e9c540318ded8f6d718e8567fdea2a6a33217907c0a31d77cdccdc66ce4e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -666,7 +666,7 @@ class Post
|
|
666
666
|
```
|
667
667
|
|
668
668
|
Then by using the `boost_receny` method, where half_life defines the half life
|
669
|
-
period of the exponential decay function:
|
669
|
+
period of the exponential decay function (non-integer values will be rounded down):
|
670
670
|
|
671
671
|
```ruby
|
672
672
|
# Posts that were published 5 day ago will have their scores cut in half
|
@@ -703,13 +703,13 @@ Post.dynamic_search({
|
|
703
703
|
},
|
704
704
|
})
|
705
705
|
|
706
|
-
# Posts that were published 29
|
706
|
+
# Posts that were published 29 months ago will have their scores cut in half
|
707
707
|
Post.dynamic_search({
|
708
708
|
fulltext: 'pizza',
|
709
709
|
boost_recency: {
|
710
710
|
field: :published_at,
|
711
711
|
half_life: {
|
712
|
-
months: 29
|
712
|
+
months: 29,
|
713
713
|
},
|
714
714
|
},
|
715
715
|
})
|
@@ -26,7 +26,7 @@ module DynamicSunspotSearch
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.build_boost_string(field, half_life)
|
29
|
-
half_life_ms = calculate_half_life_ms(half_life)
|
29
|
+
half_life_ms = calculate_half_life_ms(half_life).to_i
|
30
30
|
half_life_recip = BigDecimal((1.0/(half_life_ms)).to_s).to_s('E').downcase
|
31
31
|
"recip(ms(NOW,#{field.to_s}_dt),#{half_life_recip},100,1)"
|
32
32
|
end
|