// Copyright 2025 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#![feature(test)]
#![allow(clippy::assertions_on_result_states)]

#[cfg(test)]
extern crate test;

mod tantivy_compat;

/// Converts a document length (token count) to Tantivy's `fieldnorm_id` (u8).
///
/// This matches Tantivy's internal fieldnorm encoding and is used to compute
/// BM25 scores compatible with Tantivy's scorer.
pub use tantivy_compat::fieldnorm_code::fieldnorm_to_id;

mod query;
pub use query::*;

mod field_layout;
pub use field_layout::*;

mod physical_index_analysis;
mod physical_index_schema;
pub use physical_index_schema::*;

mod exact_value;
pub use exact_value::{exact_physical_field_type, exact_value_from_column_buffer};

mod directory;
pub use directory::*;
mod index_writer;
pub use index_writer::*;
mod index_reader;
pub use index_reader::*;
mod tokenizer;
pub use tokenizer::*;

mod brute_searcher;
pub use brute_searcher::*;

/// Legacy alias for the single text field id.
pub const FIELD_BODY: tantivy::schema::Field = SINGLE_TEXT_FIELD;
