feat: Make the Stream return a Document

This commit is contained in:
Clément Renault
2018-07-06 22:05:51 +02:00
parent 6fa164dc56
commit e8c24a0f07
3 changed files with 8 additions and 8 deletions

View File

@ -21,8 +21,8 @@ fn match_query_index(a: &Match, b: &Match) -> bool {
#[derive(Debug, Clone)]
pub struct Document {
document_id: DocumentId,
matches: Vec<Match>,
pub document_id: DocumentId,
pub matches: Vec<Match>,
}
impl Document {
@ -210,7 +210,7 @@ impl<'m, 'v> RankedStream<'m, 'v> {
}
impl<'m, 'v, 'a> fst::Streamer<'a> for RankedStream<'m, 'v> {
type Item = DocumentId;
type Item = Document;
fn next(&'a mut self) -> Option<Self::Item> {
let mut matches = HashMap::new();
@ -260,7 +260,7 @@ impl<'m, 'v, 'a> fst::Streamer<'a> for RankedStream<'m, 'v> {
}
},
RankedStream::Pours { inner } => {
return inner.next().map(|d| d.document_id)
return inner.next()
},
}