From 095fb68fdacca2655ee4eaa31b8828d376c15edb Mon Sep 17 00:00:00 2001 From: Pascal Seitz Date: Sun, 28 Aug 2022 18:19:17 +0200 Subject: [PATCH] fix doc test --- src/collector/top_score_collector.rs | 10 +++++----- src/fastfield/serializer/mod.rs | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/collector/top_score_collector.rs b/src/collector/top_score_collector.rs index 68ba8e8f5..eb4443e04 100644 --- a/src/collector/top_score_collector.rs +++ b/src/collector/top_score_collector.rs @@ -409,7 +409,7 @@ impl TopDocs { /// # use tantivy::query::QueryParser; /// use tantivy::SegmentReader; /// use tantivy::collector::TopDocs; - /// use tantivy::fastfield::FastFieldReader; + /// use tantivy::fastfield::Column; /// use tantivy::schema::Field; /// /// fn create_schema() -> Schema { @@ -458,7 +458,7 @@ impl TopDocs { /// /// // We can now define our actual scoring function /// move |doc: DocId, original_score: Score| { - /// let popularity: u64 = popularity_reader.get(doc); + /// let popularity: u64 = popularity_reader.get_val(doc as u64); /// // Well.. For the sake of the example we use a simple logarithm /// // function. /// let popularity_boost_score = ((2u64 + popularity) as Score).log2(); @@ -517,7 +517,7 @@ impl TopDocs { /// use tantivy::SegmentReader; /// use tantivy::collector::TopDocs; /// use tantivy::schema::Field; - /// use tantivy::fastfield::FastFieldReader; + /// use fastfield_codecs::Column; /// /// # fn create_schema() -> Schema { /// # let mut schema_builder = Schema::builder(); @@ -569,8 +569,8 @@ impl TopDocs { /// /// // We can now define our actual scoring function /// move |doc: DocId| { - /// let popularity: u64 = popularity_reader.get(doc); - /// let boosted: u64 = boosted_reader.get(doc); + /// let popularity: u64 = popularity_reader.get_val(doc as u64); + /// let boosted: u64 = boosted_reader.get_val(doc as u64); /// // Score do not have to be `f64` in tantivy. /// // Here we return a couple to get lexicographical order /// // for free. diff --git a/src/fastfield/serializer/mod.rs b/src/fastfield/serializer/mod.rs index f4efea3cd..85f5e4e4b 100644 --- a/src/fastfield/serializer/mod.rs +++ b/src/fastfield/serializer/mod.rs @@ -64,8 +64,8 @@ impl From for FastFieldCodecEnableCheck { // use this, when this is merged and stabilized explicit_generic_args_with_impl_trait // https://github.com/rust-lang/rust/pull/86176 -fn codec_estimation( - fastfield_accessor: &impl Column, +fn codec_estimation( + fastfield_accessor: &D, estimations: &mut Vec<(f32, FastFieldCodecType)>, ) { if let Some(ratio) = C::estimate(fastfield_accessor) { @@ -202,13 +202,13 @@ impl CompositeFastFieldSerializer { let mut estimations = vec![]; if codec_enable_checker.is_enabled(FastFieldCodecType::Bitpacked) { - codec_estimation::(&fastfield_accessor, &mut estimations); + codec_estimation::(&fastfield_accessor, &mut estimations); } if codec_enable_checker.is_enabled(FastFieldCodecType::Linear) { - codec_estimation::(&fastfield_accessor, &mut estimations); + codec_estimation::(&fastfield_accessor, &mut estimations); } if codec_enable_checker.is_enabled(FastFieldCodecType::BlockwiseLinear) { - codec_estimation::(&fastfield_accessor, &mut estimations); + codec_estimation::(&fastfield_accessor, &mut estimations); } if let Some(broken_estimation) = estimations.iter().find(|estimation| estimation.0.is_nan()) {