2019-10-18 19:05:28 +08:00
|
|
|
use std::cmp::Ordering;
|
2019-10-02 23:34:32 +08:00
|
|
|
|
2019-12-12 00:02:10 +08:00
|
|
|
use compact_arena::SmallArena;
|
|
|
|
|
|
|
|
use crate::automaton::QueryEnhancer;
|
|
|
|
use crate::bucket_sort::{PostingsListView, QueryWordAutomaton};
|
|
|
|
use crate::RawDocument;
|
|
|
|
use super::Criterion;
|
|
|
|
|
2019-10-02 23:34:32 +08:00
|
|
|
pub struct DocumentId;
|
|
|
|
|
|
|
|
impl Criterion for DocumentId {
|
2019-12-12 00:02:10 +08:00
|
|
|
fn name(&self) -> &str { "stable document id" }
|
|
|
|
|
|
|
|
fn prepare(
|
|
|
|
&self,
|
|
|
|
documents: &mut [RawDocument],
|
|
|
|
postings_lists: &mut SmallArena<PostingsListView>,
|
|
|
|
query_enhancer: &QueryEnhancer,
|
|
|
|
automatons: &[QueryWordAutomaton],
|
|
|
|
) {
|
|
|
|
// ...
|
2019-10-02 23:34:32 +08:00
|
|
|
}
|
|
|
|
|
2019-12-12 00:02:10 +08:00
|
|
|
fn evaluate(
|
|
|
|
&self,
|
|
|
|
lhs: &RawDocument,
|
|
|
|
rhs: &RawDocument,
|
|
|
|
postings_lists: &SmallArena<PostingsListView>,
|
|
|
|
) -> Ordering
|
|
|
|
{
|
|
|
|
let lhs = &lhs.id;
|
|
|
|
let rhs = &rhs.id;
|
|
|
|
|
|
|
|
lhs.cmp(rhs)
|
2019-10-02 23:34:32 +08:00
|
|
|
}
|
|
|
|
}
|