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 Elasticsearch::DSL::Search.search do
sort do sort do
if options[:sort_by] == 'date' if options[:sort_by] == 'score'
by :published_at, order: 'desc' by '_score'
end end
by '_score' by :published_at, order: 'desc'
end end
query do query do