Made BooleanWeight and BoostWeight public (#1991)

This commit is contained in:
Paul Masurel
2023-04-12 10:26:30 +09:00
committed by GitHub
parent 0ed13eeea8
commit 4b01cc4c49
4 changed files with 8 additions and 5 deletions

View File

@@ -67,6 +67,7 @@ fn into_box_scorer<TScoreCombiner: ScoreCombiner>(
}
}
/// Weight associated to the `BoolQuery`.
pub struct BooleanWeight<TScoreCombiner: ScoreCombiner> {
weights: Vec<(Occur, Box<dyn Weight>)>,
scoring_enabled: bool,
@@ -74,6 +75,7 @@ pub struct BooleanWeight<TScoreCombiner: ScoreCombiner> {
}
impl<TScoreCombiner: ScoreCombiner> BooleanWeight<TScoreCombiner> {
/// Creates a new boolean weight.
pub fn new(
weights: Vec<(Occur, Box<dyn Weight>)>,
scoring_enabled: bool,

View File

@@ -4,7 +4,7 @@ mod boolean_weight;
pub(crate) use self::block_wand::{block_wand, block_wand_single_scorer};
pub use self::boolean_query::BooleanQuery;
pub(crate) use self::boolean_weight::BooleanWeight;
pub use self::boolean_weight::BooleanWeight;
#[cfg(test)]
mod tests {

View File

@@ -54,12 +54,14 @@ impl Query for BoostQuery {
}
}
pub(crate) struct BoostWeight {
/// Weight associated to the BoostQuery.
pub struct BoostWeight {
weight: Box<dyn Weight>,
boost: Score,
}
impl BoostWeight {
/// Creates a new BoostWeight.
pub fn new(weight: Box<dyn Weight>, boost: Score) -> Self {
BoostWeight { weight, boost }
}

View File

@@ -35,9 +35,8 @@ pub use self::all_query::{AllQuery, AllScorer, AllWeight};
pub use self::automaton_weight::AutomatonWeight;
pub use self::bitset::BitSetDocSet;
pub use self::bm25::{Bm25StatisticsProvider, Bm25Weight};
pub use self::boolean_query::BooleanQuery;
pub(crate) use self::boolean_query::BooleanWeight;
pub use self::boost_query::BoostQuery;
pub use self::boolean_query::{BooleanQuery, BooleanWeight};
pub use self::boost_query::{BoostQuery, BoostWeight};
pub use self::const_score_query::{ConstScoreQuery, ConstScorer};
pub use self::disjunction_max_query::DisjunctionMaxQuery;
pub use self::empty_query::{EmptyQuery, EmptyScorer, EmptyWeight};