Class: Sunspot::RandomField
- Inherits:
-
Object
- Object
- Sunspot::RandomField
- Defined in:
- lib/sunspot/field.rb
Overview
RandomField instances are used for random sorting.
Instance Method Summary collapse
-
#indexed_name ⇒ Object
Solr uses the dynamic field name as a seed for random, so we randomize the field name accordingly.
-
#multiple? ⇒ Boolean
Never multiple, but this has to return false so Sunspot doesn’t barf when you try to order by it.
Instance Method Details
#indexed_name ⇒ Object
Solr uses the dynamic field name as a seed for random, so we randomize the field name accordingly.
#XXX I think it’s bad to use a random number as a seed. Would it be better to pass in the current timestamp or some such thing?
153 154 155 |
# File 'lib/sunspot/field.rb', line 153 def indexed_name "random_#{rand(1<<16)}" end |
#multiple? ⇒ Boolean
Never multiple, but this has to return false so Sunspot doesn’t barf when you try to order by it.
142 143 144 |
# File 'lib/sunspot/field.rb', line 142 def multiple? false end |