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

17 lines
366 B
Rust
Raw Normal View History

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