Skip to content

Commit 5de2cfa

Browse files
authored
remove DocMapper trait (#5508)
* remove DocMapper trait * rename default docmapper to docmapper * use IgnoredAny
1 parent a49f5c4 commit 5de2cfa

35 files changed

+425
-626
lines changed

quickwit/Cargo.lock

Lines changed: 0 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

quickwit/quickwit-config/src/index_config/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use chrono::Utc;
3030
use cron::Schedule;
3131
use humantime::parse_duration;
3232
use quickwit_common::uri::Uri;
33-
use quickwit_doc_mapper::{DefaultDocMapperBuilder, DocMapper, DocMapping};
33+
use quickwit_doc_mapper::{DocMapper, DocMapperBuilder, DocMapping};
3434
use quickwit_proto::types::IndexId;
3535
use serde::{Deserialize, Serialize};
3636
pub use serialize::{load_index_config_from_user_config, load_index_config_update};
@@ -473,10 +473,11 @@ impl crate::TestableForRegression for IndexConfig {
473473
pub fn build_doc_mapper(
474474
doc_mapping: &DocMapping,
475475
search_settings: &SearchSettings,
476-
) -> anyhow::Result<Arc<dyn DocMapper>> {
477-
let builder = DefaultDocMapperBuilder {
476+
) -> anyhow::Result<Arc<DocMapper>> {
477+
let builder = DocMapperBuilder {
478478
doc_mapping: doc_mapping.clone(),
479479
default_search_fields: search_settings.default_search_fields.clone(),
480+
legacy_type_tag: None,
480481
};
481482
Ok(Arc::new(builder.try_build()?))
482483
}

quickwit/quickwit-config/src/index_config/serialize.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::collections::HashSet;
2121

2222
use anyhow::{ensure, Context};
2323
use quickwit_common::uri::Uri;
24-
use quickwit_doc_mapper::DefaultDocMapperBuilder;
24+
use quickwit_doc_mapper::DocMapperBuilder;
2525
use quickwit_proto::types::{DocMappingUid, IndexId};
2626
use serde::{Deserialize, Serialize};
2727
use tracing::info;
@@ -103,12 +103,13 @@ pub fn load_index_config_update(
103103
);
104104

105105
// verify the new mapping is coherent
106-
let doc_mapper_builder = DefaultDocMapperBuilder {
106+
let doc_mapper_builder = DocMapperBuilder {
107107
doc_mapping: new_index_config.doc_mapping.clone(),
108108
default_search_fields: new_index_config
109109
.search_settings
110110
.default_search_fields
111111
.clone(),
112+
legacy_type_tag: None,
112113
};
113114
doc_mapper_builder
114115
.try_build()

quickwit/quickwit-doc-mapper/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ license.workspace = true
1313
[dependencies]
1414
anyhow = { workspace = true }
1515
base64 = { workspace = true }
16-
dyn-clone = { workspace = true }
1716
fnv = { workspace = true }
1817
hex = { workspace = true }
1918
indexmap = { workspace = true }
@@ -28,7 +27,6 @@ siphasher = { workspace = true }
2827
tantivy = { workspace = true }
2928
thiserror = { workspace = true }
3029
tracing = { workspace = true }
31-
typetag = { workspace = true }
3230
utoipa = { workspace = true }
3331

3432
quickwit-common = { workspace = true }

quickwit/quickwit-doc-mapper/benches/doc_to_json_bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const DOC_MAPPER_CONF: &str = r#"{
3636
}"#;
3737

3838
pub fn simple_json_to_doc_benchmark(c: &mut Criterion) {
39-
let doc_mapper: Box<dyn DocMapper> = serde_json::from_str(DOC_MAPPER_CONF).unwrap();
39+
let doc_mapper: Box<DocMapper> = serde_json::from_str(DOC_MAPPER_CONF).unwrap();
4040
let lines: Vec<&str> = JSON_TEST_DATA.lines().map(|line| line.trim()).collect();
4141

4242
let mut group = c.benchmark_group("simple-json-to-doc");

quickwit/quickwit-doc-mapper/benches/routing_expression_bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const DOC_MAPPER_CONF: &str = r#"{
4545
}"#;
4646

4747
pub fn simple_routing_expression_benchmark(c: &mut Criterion) {
48-
let doc_mapper: Box<dyn DocMapper> = serde_json::from_str(DOC_MAPPER_CONF).unwrap();
48+
let doc_mapper: Box<DocMapper> = serde_json::from_str(DOC_MAPPER_CONF).unwrap();
4949
let lines: Vec<&str> = JSON_TEST_DATA.lines().map(|line| line.trim()).collect();
5050

5151
let json_lines: Vec<serde_json::Map<String, JsonValue>> = lines

quickwit/quickwit-doc-mapper/src/default_doc_mapper/mod.rs

Lines changed: 0 additions & 157 deletions
This file was deleted.

quickwit/quickwit-doc-mapper/src/default_doc_mapper/date_time_type.rs renamed to quickwit/quickwit-doc-mapper/src/doc_mapper/date_time_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ mod tests {
185185
use time::macros::datetime;
186186

187187
use super::*;
188-
use crate::default_doc_mapper::FieldMappingType;
188+
use crate::doc_mapper::FieldMappingType;
189189
use crate::{Cardinality, FieldMappingEntry};
190190

191191
#[test]

0 commit comments

Comments
 (0)