use std::fmt;
/// Special sorting field variants
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
pub enum SortSpecialField {
/// Document score
#[serde(rename = "_score")]
Score,
/// The most efficient way to sort, does not guarantee any order, useful for
/// scrolling
#[serde(rename = "_doc")]
DocumentIndexOrder,
/// Sorts by shard doc value, useful for PIT queries
#[serde(rename = "_shard_doc")]
ShardDocumentOrder,
}
impl fmt::Display for SortSpecialField {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
Self::Score => "_score",
Self::DocumentIndexOrder => "_doc",
Self::ShardDocumentOrder => "_shard_doc",
})
}
}