by default sort by published date, as initial web site shows all papers and thus there is no query yet that can be sorted by relevance

This commit is contained in:
Joerg Reichert 2016-03-26 13:40:39 +01:00
parent 0718e86f07
commit 5ef5975ad7

View file

@ -9,10 +9,10 @@ class PaperSearch < ActiveRecord::Base
Elasticsearch::DSL::Search.search do
sort do
if options[:sort_by] == 'date'
by :published_at, order: 'desc'
if options[:sort_by] == 'score'
by '_score'
end
by '_score'
by :published_at, order: 'desc'
end
query do