meilisearch/meilisearch-core/src/criterion/document_id.rs

17 lines
366 B
Rust
Raw Normal View History

2019-10-18 19:05:28 +08:00
use std::cmp::Ordering;
2019-12-12 00:02:10 +08:00
use crate::RawDocument;
use super::{Criterion, Context};
2019-12-12 00:02:10 +08:00
pub struct DocumentId;
impl Criterion for DocumentId {
2019-12-12 00:02:10 +08:00
fn name(&self) -> &str { "stable document id" }
fn evaluate(&self, _ctx: &Context, lhs: &RawDocument, rhs: &RawDocument) -> Ordering {
2019-12-12 00:02:10 +08:00
let lhs = &lhs.id;
let rhs = &rhs.id;
lhs.cmp(rhs)
}
}