use std::io;
use crate::document::{IndexOptions, TermOffset};
pub const NO_MORE_DOCS: i32 = i32::MAX;
pub trait FieldsProducer {
fn field_names(&self) -> Vec<String>;
fn terms(&self, field: &str) -> Option<Box<dyn TermsProducer + '_>>;
}
pub trait TermsProducer {
fn iterator(&self) -> io::Result<Box<dyn TermsEnumProducer + '_>>;
fn has_freqs(&self) -> bool;
fn has_positions(&self) -> bool;
fn has_offsets(&self) -> bool;
fn has_payloads(&self) -> bool;
}
pub trait TermsEnumProducer {
fn next(&mut self) -> io::Result<Option<&[u8]>>;
fn postings(&mut self) -> io::Result<Box<dyn PostingsEnumProducer + '_>>;
}
pub trait FieldTerms {
fn term_count(&self) -> usize;
fn term_bytes(&self, index: usize) -> &[u8];
fn postings(&self, index: usize) -> io::Result<Box<dyn PostingsEnumProducer + '_>>;
fn index_options(&self) -> IndexOptions;
fn has_payloads(&self) -> bool;
fn field_number(&self) -> u32;
fn field_name(&self) -> &str;
}
pub trait PostingsEnumProducer {
fn doc_freq(&self) -> i32;
fn total_term_freq(&self) -> i64;
fn next_doc(&mut self) -> io::Result<i32>;
fn freq(&self) -> i32;
fn next_position(&mut self) -> io::Result<i32>;
fn offset(&self) -> Option<TermOffset>;
fn payload(&self) -> Option<&[u8]>;
}