mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-24 02:55:06 +08:00
17 lines
366 B
Rust
17 lines
366 B
Rust
use std::cmp::Ordering;
|
|
use crate::RawDocument;
|
|
use super::{Criterion, Context};
|
|
|
|
pub struct DocumentId;
|
|
|
|
impl Criterion for DocumentId {
|
|
fn name(&self) -> &str { "stable document id" }
|
|
|
|
fn evaluate(&self, _ctx: &Context, lhs: &RawDocument, rhs: &RawDocument) -> Ordering {
|
|
let lhs = &lhs.id;
|
|
let rhs = &rhs.id;
|
|
|
|
lhs.cmp(rhs)
|
|
}
|
|
}
|