Class: Search::SortField

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_ferret/ferret_extensions.rb

Overview

add marshalling support to SortFields

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

._load(string) ⇒ Object



159
160
161
162
163
164
165
166
167
168
# File 'lib/acts_as_ferret/ferret_extensions.rb', line 159

def self._load(string)
  case string
    when /<DOC(_ID)?>!/         then Ferret::Search::SortField::DOC_ID_REV
    when /<DOC(_ID)?>/          then Ferret::Search::SortField::DOC_ID
    when '<SCORE>!'             then Ferret::Search::SortField::SCORE_REV
    when '<SCORE>'              then Ferret::Search::SortField::SCORE
    when /^(\w+):<(\w+)>(!)?$/  then new($1.to_sym, :type => $2.to_sym, :reverse => !$3.nil?)
    else raise "invalid value: #{string}"
  end
end

Instance Method Details

#_dump(depth) ⇒ Object



155
156
157
# File 'lib/acts_as_ferret/ferret_extensions.rb', line 155

def _dump(depth)
  to_s
end