mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-30 08:44:27 +01: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)
|
|
}
|
|
}
|