Class: MmEsSearch::Api::Sort::RootSort

Inherits:
Object
  • Object
show all
Includes:
MongoMapper::EmbeddedDocument
Defined in:
lib/mm_es_search/api/sort/root_sort.rb

Instance Method Summary collapse

Instance Method Details

#to_es_queryObject



23
24
25
26
27
28
29
30
# File 'lib/mm_es_search/api/sort/root_sort.rb', line 23

def to_es_query
  case direction
  when "asc", "ascending", nil
    {field => {:order => :asc}}
  when "desc", "descending"
    {field => {:order => :desc}}
  end
end

#to_mongo_queryObject



14
15
16
17
18
19
20
21
# File 'lib/mm_es_search/api/sort/root_sort.rb', line 14

def to_mongo_query
  case direction
  when "asc", "ascending", nil
    {field => :asc}
  when "desc", "descending"
    {field => :desc}
  end
end