Skip to content

Commit

Permalink
Sort on non-formatted date field
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhoads committed Jun 3, 2022
1 parent cde41e2 commit 75013ef
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/models/reference_repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,14 @@ def as_indexed_json(_options = {})
indexes :client_id
indexes :re3doi
indexes :re3data_url
indexes :created_at, type: :date, format: :date_optional_time
indexes :updated_at, type: :date, format: :date_optional_time
indexes :created_at, type: :date, format: :date_optional_time,
fields: {
created_sort: { type: :date }
}
indexes :updated_at, type: :date, format: :date_optional_time,
fields: {
updated_sort: { type: :date }
}
indexes :name
indexes :alternate_name
indexes :description
Expand Down Expand Up @@ -273,7 +279,7 @@ def query(query, options = {})
def sort_fields
[
{ _score: { order: "desc" } },
{ created_at: { order: "asc" } },
{ "created_at.created_sort": { order: "asc" } },
{ "uid.raw": { order: "asc" } },
]
end
Expand Down

0 comments on commit 75013ef

Please sign in to comment.