mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-02-27 04:37:18 +08:00
20 lines
410 B
Rust
20 lines
410 B
Rust
|
use std::cmp::Ordering;
|
||
|
use std::ops::Deref;
|
||
|
|
||
|
use rocksdb::DB;
|
||
|
|
||
|
use crate::rank::criterion::Criterion;
|
||
|
use crate::database::DatabaseView;
|
||
|
use crate::rank::Document;
|
||
|
|
||
|
#[derive(Debug, Clone, Copy)]
|
||
|
pub struct DocumentId;
|
||
|
|
||
|
impl<D> Criterion<D> for DocumentId
|
||
|
where D: Deref<Target=DB>
|
||
|
{
|
||
|
fn evaluate(&self, lhs: &Document, rhs: &Document, _: &DatabaseView<D>) -> Ordering {
|
||
|
lhs.id.cmp(&rhs.id)
|
||
|
}
|
||
|
}
|