diff --git a/app/controllers/datacite_dois_controller.rb b/app/controllers/datacite_dois_controller.rb index ef5c488f2..46c3d51b9 100644 --- a/app/controllers/datacite_dois_controller.rb +++ b/app/controllers/datacite_dois_controller.rb @@ -50,7 +50,7 @@ def index when "relevance" { "_score": { "order": "desc" } } else - { "_score": { "order": "desc" } } + { updated: { order: "desc" } } end page = page_from_params(params) diff --git a/app/models/doi.rb b/app/models/doi.rb index 9f933d350..53a9f83ce 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -2518,7 +2518,7 @@ def update_publisher_from_hash def update_publisher_from_string self.publisher_obj = { name: publisher_before_type_cast } - end + end def reset_publishers self.publisher_obj = nil diff --git a/app/models/doi/graphql_query.rb b/app/models/doi/graphql_query.rb index 5461676d5..6c10d1599 100644 --- a/app/models/doi/graphql_query.rb +++ b/app/models/doi/graphql_query.rb @@ -4,7 +4,7 @@ module Doi::GraphqlQuery class Builder include Modelable - DEFAULT_CURSOR = ["Infinity", 0] + DEFAULT_CURSOR = [0, ""] DEFAULT_PAGE_SIZE = 0 DEFAULT_FACET_COUNT = 10 @@ -29,7 +29,7 @@ def size end def sort - [{ _score: "desc", uid: "asc" }] + [{ created: "asc", uid: "asc" }] end def query_fields @@ -47,16 +47,16 @@ def query_fields def cursor tmp_cursor = @options.dig(:page, :cursor) - if tmp_cursor.blank? + if tmp_cursor.nil? return DEFAULT_CURSOR end if tmp_cursor.is_a?(Array) - tmp_score, uid = tmp_cursor + timestamp, uid = tmp_cursor elsif tmp_cursor.is_a?(String) - tmp_score, uid = tmp_cursor.split(",") + timestamp, uid = tmp_cursor.split(",") end - [tmp_score.to_f, uid.to_s] + [timestamp.to_i, uid.to_s] end def search_after