summaryrefslogtreecommitdiffstats
path: root/src/postings/segment_postings_option.rs
blob: 51a07bb0bcfe0fe5c752e42dad18a6573b4c805f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/// Object describing the amount of information required when reading a postings.
///
/// Since decoding information is not free, this makes it possible to
/// avoid this extra cost when the information is not required.
/// For instance, positions are useful when running phrase queries
/// but useless in other queries.
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Ord, Eq)]
pub enum SegmentPostingsOption {
    /// Only the doc ids are decoded
    NoFreq,
    /// DocIds and term frequencies are decoded
    Freq,
    /// DocIds, term frequencies and positions will be decoded.
    FreqAndPositions,
}

#[cfg(test)]
mod tests {

    use super::SegmentPostingsOption;

    #[test]
    fn test_cmp_segment_postings_option() {
        assert!(SegmentPostingsOption::FreqAndPositions > SegmentPostingsOption::Freq);
        assert!(SegmentPostingsOption::Freq > SegmentPostingsOption::NoFreq);
    }
}