Skip to content

Commit

Permalink
remove DocMapper trait (#5508)
Browse files Browse the repository at this point in the history
* remove DocMapper trait

* rename default docmapper to docmapper

* use IgnoredAny
  • Loading branch information
PSeitz authored Oct 22, 2024
1 parent a49f5c4 commit 5de2cfa
Show file tree
Hide file tree
Showing 35 changed files with 425 additions and 626 deletions.
49 changes: 0 additions & 49 deletions quickwit/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions quickwit/quickwit-config/src/index_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use chrono::Utc;
use cron::Schedule;
use humantime::parse_duration;
use quickwit_common::uri::Uri;
use quickwit_doc_mapper::{DefaultDocMapperBuilder, DocMapper, DocMapping};
use quickwit_doc_mapper::{DocMapper, DocMapperBuilder, DocMapping};
use quickwit_proto::types::IndexId;
use serde::{Deserialize, Serialize};
pub use serialize::{load_index_config_from_user_config, load_index_config_update};
Expand Down Expand Up @@ -473,10 +473,11 @@ impl crate::TestableForRegression for IndexConfig {
pub fn build_doc_mapper(
doc_mapping: &DocMapping,
search_settings: &SearchSettings,
) -> anyhow::Result<Arc<dyn DocMapper>> {
let builder = DefaultDocMapperBuilder {
) -> anyhow::Result<Arc<DocMapper>> {
let builder = DocMapperBuilder {
doc_mapping: doc_mapping.clone(),
default_search_fields: search_settings.default_search_fields.clone(),
legacy_type_tag: None,
};
Ok(Arc::new(builder.try_build()?))
}
Expand Down
5 changes: 3 additions & 2 deletions quickwit/quickwit-config/src/index_config/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::collections::HashSet;

use anyhow::{ensure, Context};
use quickwit_common::uri::Uri;
use quickwit_doc_mapper::DefaultDocMapperBuilder;
use quickwit_doc_mapper::DocMapperBuilder;
use quickwit_proto::types::{DocMappingUid, IndexId};
use serde::{Deserialize, Serialize};
use tracing::info;
Expand Down Expand Up @@ -103,12 +103,13 @@ pub fn load_index_config_update(
);

// verify the new mapping is coherent
let doc_mapper_builder = DefaultDocMapperBuilder {
let doc_mapper_builder = DocMapperBuilder {
doc_mapping: new_index_config.doc_mapping.clone(),
default_search_fields: new_index_config
.search_settings
.default_search_fields
.clone(),
legacy_type_tag: None,
};
doc_mapper_builder
.try_build()
Expand Down
2 changes: 0 additions & 2 deletions quickwit/quickwit-doc-mapper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ license.workspace = true
[dependencies]
anyhow = { workspace = true }
base64 = { workspace = true }
dyn-clone = { workspace = true }
fnv = { workspace = true }
hex = { workspace = true }
indexmap = { workspace = true }
Expand All @@ -28,7 +27,6 @@ siphasher = { workspace = true }
tantivy = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }
typetag = { workspace = true }
utoipa = { workspace = true }

quickwit-common = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion quickwit/quickwit-doc-mapper/benches/doc_to_json_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const DOC_MAPPER_CONF: &str = r#"{
}"#;

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

let mut group = c.benchmark_group("simple-json-to-doc");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const DOC_MAPPER_CONF: &str = r#"{
}"#;

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

let json_lines: Vec<serde_json::Map<String, JsonValue>> = lines
Expand Down
157 changes: 0 additions & 157 deletions quickwit/quickwit-doc-mapper/src/default_doc_mapper/mod.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ mod tests {
use time::macros::datetime;

use super::*;
use crate::default_doc_mapper::FieldMappingType;
use crate::doc_mapper::FieldMappingType;
use crate::{Cardinality, FieldMappingEntry};

#[test]
Expand Down
Loading

0 comments on commit 5de2cfa

Please sign in to comment.