1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use cipherstash_grpc::api::documents::{Term, Vector};
use crate::indexer::vector::{TermVector, VectorTerm};
impl From<VectorTerm> for Term {
fn from(VectorTerm { term, link, bits }: VectorTerm) -> Self {
Self {
term: term.0.into_iter().map(|x| x.to_bytes()).collect(),
link: link.as_bytes().to_vec(),
bits: bits.into_iter().map(|x| x.into()).collect(),
}
}
}
impl From<TermVector> for Vector {
fn from(TermVector { terms, index_id }: TermVector) -> Self {
Self {
terms: terms.into_iter().map(|x| x.into()).collect(),
index_id: index_id.as_bytes().to_vec(),
}
}
}