use serde::{Deserialize, Serialize};
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Ord, Eq, Hash, Serialize, Deserialize)]
pub enum IndexRecordOption {
#[serde(rename = "basic")]
Basic,
#[serde(rename = "freq")]
WithFreqs,
#[serde(rename = "position")]
WithFreqsAndPositions,
}
impl Default for IndexRecordOption {
fn default() -> Self {
IndexRecordOption::Basic
}
}
impl IndexRecordOption {
pub fn has_freq(self) -> bool {
match self {
IndexRecordOption::Basic => false,
IndexRecordOption::WithFreqs | IndexRecordOption::WithFreqsAndPositions => true,
}
}
pub fn has_positions(self) -> bool {
match self {
IndexRecordOption::Basic | IndexRecordOption::WithFreqs => false,
IndexRecordOption::WithFreqsAndPositions => true,
}
}
}