Class: Sunspot::Type::DateRangeType
Constant Summary
Constants inherited
from TimeType
TimeType::XMLSCHEMA
Instance Method Summary
collapse
Methods inherited from TimeType
#to_literal
#accepts_dynamic?, #accepts_more_like_this?, #to_literal
Instance Method Details
#cast(value) ⇒ Object
391
392
393
394
|
# File 'lib/sunspot/type.rb', line 391
def cast(value)
return super unless m = value.match(/^\[(?<start>.+) TO (?<end>.+)\]$/)
Range.new super(m[:start]), super(m[:end])
end
|
#indexed_name(name) ⇒ Object
379
380
381
|
# File 'lib/sunspot/type.rb', line 379
def indexed_name(name)
"#{name}_dr"
end
|
#to_indexed(value) ⇒ Object
383
384
385
386
387
388
389
|
# File 'lib/sunspot/type.rb', line 383
def to_indexed(value)
if value.respond_to?(:first) && value.respond_to?(:last)
"[#{super value.first} TO #{super value.last}]"
else
super value
end
end
|