2019-10-18 13:05:28 +02:00
|
|
|
use std::cmp::Ordering;
|
2019-12-11 17:02:10 +01:00
|
|
|
use crate::RawDocument;
|
2019-12-12 11:33:39 +01:00
|
|
|
use super::{Criterion, Context};
|
2019-12-11 17:02:10 +01:00
|
|
|
|
2019-10-02 17:34:32 +02:00
|
|
|
pub struct DocumentId;
|
|
|
|
|
|
|
|
impl Criterion for DocumentId {
|
2019-12-11 17:02:10 +01:00
|
|
|
fn name(&self) -> &str { "stable document id" }
|
|
|
|
|
2019-12-12 11:33:39 +01:00
|
|
|
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)
|
2019-10-02 17:34:32 +02:00
|
|
|
}
|
|
|
|
}
|