fn scored_int_filtering(facet_name: &str, ints: &[i64]) -> Vec<CommonFilter<ScoredFacetFilter>> {
    let mut filters = Vec::new();

    const I64_BITS: u32 = 64;
    let count = ints.len() as u32;

    // start with the score for the highest priority tag
    let mut score = match count > I64_BITS - 1 {
        true => 1_i64 << (I64_BITS - 2), // 2_i64.pow(i64::BITS - 1),
        false if count == 0 => return vec![],
        false => 1_i64 << (count - 1),
    };

    // computes the score for the next lower priority tag
    let next_score = |score: &mut i64| match *score > 1 {
        true => *score = *score >> 1,
        false => *score = 1,
    };

    for v in ints.iter() {
        filters.push(CommonFilter {
            filter: ScoredFacetFilter {
                facet_name: facet_name.to_owned(),
                value: v.to_string(),
                score,
            },
            invert: false,
        });

        next_score(&mut score)
    }

    filters
}
/// Filter with ordered priority.
///
/// If using priority scoring, this can only rank the first 62 items.
/// This is because scores are weighted exponentially and i64::MAX = 2^63-1. 63 less one so that
/// it does not overflow when summed with lesser scores.
///
/// The remaining will be assigned a score of 1, which is the default score for all filters.
Filter with ordered priority.
If using priority scoring, this can only rank the first 62 items.
This is because scores are weighted exponentially and i64::MAX = 2^63-1. 63 less one so that
it does not overflow when summed with lesser scores.

The remaining will be assigned a score of 1, which is the default score for all filters.
Filter with ordered priority . If using priority scoring this can only rank the first 62 items . This is because scores are weighted exponentially and i64 :: MAX = 2^63 - 1 . 63 less one so that it does not overflow when summed with lesser scores . The remaining will be assigned a score of 1 which is the default score for all filters .
fn scored_int_filtering(facet_name: &str, ints: &[i64]) -> Vec<CommonFilter<ScoredFacetFilter>> {
    let mut filters = Vec::new();
    const I64_BITS: u32 = 64;
    let count = ints.len() as u32;
    // start with the score for the highest priority tag
    let mut score = match count > I64_BITS - 1 {
        true => 1_i64 << (I64_BITS - 2), // 2_i64.pow(i64::BITS - 1),
        false if count == 0 => return vec![],
        false => 1_i64 << (count - 1),
    };
    // computes the score for the next lower priority tag
    let next_score = |score: &mut i64| match *score > 1 {
        true => *score = *score >> 1,
        false => *score = 1,
    };
    for v in ints.iter() {
        filters.push(CommonFilter {
            filter: ScoredFacetFilter {
                facet_name: facet_name.to_owned(),
                value: v.to_string(),
                score,
            },
            invert: false,
        });
        next_score(&mut score)
    }
    filters
}
fn scored_int_filtering ( facet_name : & str , ints : & [ i64 ] ) -> Vec < CommonFilter < ScoredFacetFilter > > { let mut filters = Vec :: new ( ) ; const I64_BITS : u32 = 64 ; let count = ints . len ( ) as u32 ; // start with the score for the highest priority tag let mut score = match count > I64_BITS - 1 { true => 1_i64 << ( I64_BITS - 2 ) , // 2_i64.pow(i64::BITS - 1), false if count == 0 => return vec ! [ ] , false => 1_i64 << ( count - 1 ) , } ; // computes the score for the next lower priority tag let next_score = | score : & mut i64 | match * score > 1 { true => * score = * score >> 1 , false => * score = 1 , } ; for v in ints . iter ( ) { filters . push ( CommonFilter { filter : ScoredFacetFilter { facet_name : facet_name . to_owned ( ) , value : v . to_string ( ) , score , } , invert : false , } ) ; next_score ( & mut score ) } filters }
Filter with ordered priority.
Filter with ordered priority .
facet_name
&str
ints
&[i64]
facet_name
&str
ints
&[i64]