Compare commits

..

35 Commits

Author SHA1 Message Date
Paul Masurel
f5221215b3 blop 2026-01-21 14:46:51 +01:00
Paul Masurel
7d9427e9d6 cleanup 2026-01-21 13:56:54 +01:00
Paul Masurel
62b50bb254 code clenaup 2026-01-21 11:44:27 +01:00
Paul Masurel
2dcd550b74 blop 2026-01-21 11:09:37 +01:00
Paul Masurel
4840886a87 codec 2026-01-21 10:30:35 +01:00
Paul Masurel
1de872ba71 blop 2026-01-20 22:48:45 +01:00
Paul Masurel
93915ce1bf unused removed 2026-01-20 22:43:02 +01:00
Paul Masurel
bf87c54f0e blop 2026-01-20 19:58:55 +01:00
Paul Masurel
4f27b503ed blop 2026-01-20 19:00:57 +01:00
Paul Masurel
0346942174 blop 2026-01-20 14:21:10 +01:00
Paul Masurel
6ec38276a6 Remove unused imports
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 14:20:24 +01:00
Paul Masurel
476960e89b blop 2026-01-20 12:20:32 +01:00
Paul Masurel
955ce6477c blop 2026-01-20 11:27:07 +01:00
Paul Masurel
daaecf2afb blop 2026-01-20 10:42:52 +01:00
Paul Masurel
d64178906f blop 2026-01-20 10:28:57 +01:00
Paul Masurel
f1377018b0 blop 2026-01-19 16:44:47 +01:00
Paul Masurel
9fe96d06af blop 2026-01-19 15:58:09 +01:00
Paul Masurel
d9c4270acb blop 2026-01-19 15:22:50 +01:00
Paul Masurel
16d1611f4d blo 2026-01-19 15:18:28 +01:00
Paul Masurel
b296948bcd blop 2026-01-19 15:09:04 +01:00
Paul Masurel
6b7380eda8 doc freq 2026-01-19 12:18:54 +01:00
Paul Masurel
947459a0a9 tests are compiling 2026-01-16 17:28:17 +01:00
Paul Masurel
eb18182901 blop 2026-01-16 15:57:25 +01:00
Paul Masurel
01d670f60c renaming 2026-01-16 15:44:30 +01:00
Paul Masurel
b77338b590 compiling 2026-01-16 15:18:31 +01:00
Paul Masurel
c75fa94d25 blop 2026-01-16 14:09:21 +01:00
Paul Masurel
cf632673ac blop 2026-01-16 13:56:21 +01:00
Paul Masurel
6f00d96127 blop 2026-01-16 13:45:51 +01:00
Paul Masurel
a5ccb62c99 Removing block postings public accessors 2026-01-16 11:38:01 +01:00
Paul Masurel
c42505a043 added method to lift Postings into TermScorer 2026-01-16 11:21:03 +01:00
Paul Masurel
3e57eb9add Generic TermScorer 2026-01-15 18:06:26 +01:00
Paul Masurel
0955b44ce1 blop 2026-01-15 14:54:42 +01:00
Paul Masurel
783a2a6bef Removing read_block_postings 2026-01-15 12:02:10 +01:00
Paul Masurel
1e3c353e21 blop 2026-01-14 11:43:38 +01:00
Paul Masurel
799e88adbd blop 2026-01-13 20:21:22 +01:00
7 changed files with 14 additions and 24 deletions

View File

@@ -3,7 +3,7 @@ use std::io;
use crate::codec::postings::block_wand::{block_wand, block_wand_single_scorer};
use crate::codec::postings::PostingsCodec;
use crate::codec::standard::postings::block_segment_postings::BlockSegmentPostings;
use crate::codec::standard::postings::segment_postings::SegmentPostings;
pub use crate::codec::standard::postings::segment_postings::SegmentPostings;
use crate::fieldnorm::FieldNormReader;
use crate::positions::PositionReader;
use crate::query::term_query::TermScorer;

View File

@@ -12,7 +12,6 @@ use crate::query::Bm25Weight;
use crate::schema::IndexRecordOption;
use crate::{DocId, Score};
/// Default tantivy postings codec serializer.
pub struct StandardPostingsSerializer {
last_doc_id_encoded: u32,
@@ -32,7 +31,6 @@ pub struct StandardPostingsSerializer {
}
impl StandardPostingsSerializer {
/// Creates a new instance of `StandardPostingsSerializer`.
pub fn new(
avg_fieldnorm: Score,
mode: IndexRecordOption,

View File

@@ -4,8 +4,6 @@ use serde::{Deserialize, Serialize};
use crate::codec::{Codec, StandardCodec};
/// A small struct representing a codec configuration.
/// It is meant to be serialized in the index metadata file.
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct CodecConfiguration {
name: Cow<'static, str>,
@@ -14,10 +12,13 @@ pub struct CodecConfiguration {
}
impl CodecConfiguration {
/// Builds the codec given a codec_configuration.
///
/// If the configuration codec name does not match the type C,
/// a tantivy error is returned.
pub fn from_codec<C: Codec>(codec: &C) -> Self {
CodecConfiguration {
name: Cow::Borrowed(C::NAME),
props: codec.to_json_props(),
}
}
pub fn to_codec<C: Codec>(&self) -> crate::Result<C> {
if self.name != C::NAME {
return Err(crate::TantivyError::InvalidArgument(format!(
@@ -30,17 +31,8 @@ impl CodecConfiguration {
}
}
impl<'a, C: Codec> From<&'a C> for CodecConfiguration {
fn from(codec: &'a C) -> Self {
CodecConfiguration {
name: Cow::Borrowed(C::NAME),
props: codec.to_json_props(),
}
}
}
impl Default for CodecConfiguration {
fn default() -> Self {
CodecConfiguration::from(&StandardCodec)
CodecConfiguration::from_codec(&StandardCodec)
}
}

View File

@@ -276,7 +276,7 @@ impl<Codec: crate::codec::Codec> IndexBuilder<Codec> {
fn create_avoid_monomorphization(self, dir: Box<dyn Directory>) -> crate::Result<Index<Codec>> {
self.validate()?;
let directory = ManagedDirectory::wrap(dir)?;
let codec: CodecConfiguration = CodecConfiguration::from(&self.codec);
let codec: CodecConfiguration = CodecConfiguration::from_codec(&self.codec);
save_new_metas(
self.get_expect_schema()?,
self.index_settings.clone(),

View File

@@ -368,7 +368,7 @@ impl IndexMeta {
schema,
opstamp: 0u64,
payload: None,
codec: CodecConfiguration::from(codec),
codec: CodecConfiguration::from_codec(codec),
}
}

View File

@@ -239,7 +239,7 @@ pub fn merge_filtered_segments<C: crate::codec::Codec, T: Into<Box<dyn Directory
))
.trim_end()
);
let codec_configuration = CodecConfiguration::from(segments[0].index().codec());
let codec_configuration = CodecConfiguration::from_codec(segments[0].index().codec());
let index_meta = IndexMeta {
index_settings: target_settings, // index_settings of all segments should be the same
@@ -410,7 +410,7 @@ impl<Codec: crate::codec::Codec> SegmentUpdater<Codec> {
//
// Segment 1 from disk 1, Segment 1 from disk 2, etc.
committed_segment_metas.sort_by_key(|segment_meta| -(segment_meta.max_doc() as i32));
let codec = CodecConfiguration::from(index.codec());
let codec = CodecConfiguration::from_codec(index.codec());
let index_meta = IndexMeta {
index_settings: index.settings().clone(),
segments: committed_segment_metas,

View File

@@ -53,7 +53,7 @@ impl<Codec: crate::codec::Codec, D: Document> SingleSegmentIndexWriter<Codec, D>
schema: index.schema(),
opstamp: 0,
payload: None,
codec: CodecConfiguration::from(index.codec()),
codec: CodecConfiguration::from_codec(index.codec()),
};
save_metas(&index_meta, index.directory())?;
index.directory().sync_directory()?;