caio.co/de/cantine

Adapt cantine to tantivy 0.15

Id
3a4335b44fb370dbd5a20b2f8fd32054fd5a106b
Author
Caio
Commit time
2021-06-14T16:26:16+02:00

Modified cantine/Cargo.toml

@@ -23,7 +23,7
memmap = "0.7"
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
-tantivy = "0.14"
+tantivy = "0.15"
uuid = { version = "0.8", features = ["serde"] }
zerocopy = "0.3"

Modified cantine/src/index.rs

@@ -5,10 +5,10
use tantivy::{
self,
collector::Collector,
- fastfield::FastFieldReader,
+ fastfield::{DynamicFastFieldReader, FastFieldReader},
query::Query,
schema::{Field, Schema, SchemaBuilder, Value, FAST, INDEXED, STORED, TEXT},
- DocId, Document, Result, Score, Searcher, SegmentLocalId, SegmentReader, TantivyError,
+ DocId, Document, Result, Score, Searcher, SegmentOrdinal, SegmentReader, TantivyError,
};

use crate::model::{
@@ -274,7 +274,7

#[derive(Clone)]
pub struct PaginationCondition<T> {
- id_reader: FastFieldReader<RecipeId>,
+ id_reader: DynamicFastFieldReader<RecipeId>,
ref_id: RecipeId,
ref_score: T,
}
@@ -283,7 +283,7
where
T: 'static + PartialOrd + Clone,
{
- fn check(&self, _sid: SegmentLocalId, doc_id: DocId, score: T, ascending: bool) -> bool {
+ fn check(&self, _sid: SegmentOrdinal, doc_id: DocId, score: T, ascending: bool) -> bool {
let recipe_id = self.id_reader.get(doc_id);
match self.ref_score.partial_cmp(&score) {
Some(Ordering::Greater) => !ascending,