Skip to content

Commit

Permalink
support concatenated field as default search field (#5331)
Browse files Browse the repository at this point in the history
  • Loading branch information
trinity-1686a authored Aug 21, 2024
1 parent 108ad21 commit dcfab3c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 16 deletions.
18 changes: 9 additions & 9 deletions quickwit/Cargo.lock

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

2 changes: 1 addition & 1 deletion quickwit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ quickwit-serve = { path = "quickwit-serve" }
quickwit-storage = { path = "quickwit-storage" }
quickwit-telemetry = { path = "quickwit-telemetry" }

tantivy = { git = "https://github.com/quickwit-oss/tantivy/", rev = "c71ec80", default-features = false, features = [
tantivy = { git = "https://github.com/quickwit-oss/tantivy/", rev = "9f81d59", default-features = false, features = [
"lz4-compression",
"mmap",
"quickwit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1735,6 +1735,28 @@ mod tests {
.contains("concatenate type must have at least one sub-field"));
}

#[test]
fn test_concatenate_field_in_default_field() {
serde_json::from_str::<DefaultDocMapper>(
r#"{
"default_search_fields": ["concat"],
"field_mappings": [
{
"name": "some_text",
"type": "text"
},
{
"name": "concat",
"type": "concatenate",
"concatenate_fields": ["some_text"]
}
],
"mode": "strict"
}"#,
)
.unwrap();
}

#[test]
fn test_concatenate_field_in_mapping() {
test_doc_from_json_test_aux(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ expected:
message:
$expect: "\"unknown default search field `regular_field`\" in val"
---
# should fail because default search field targets the root
# of a json field.
# should fail because default search field targets a sub field of a
# non-json field
method: POST
endpoint: indexes/
json:
Expand All @@ -26,15 +26,15 @@ json:
doc_mapping:
mode: dynamic
field_mappings:
- name: inner_json
type: json
- name: text
type: text
search_settings:
default_search_fields:
- inner_json
- text.inner
status_code: 400
expected:
message:
$expect: "\"unknown default search field `inner_json`\" in val"
$expect: "\"unknown default search field `text.inner`\" in val"
---
# should fail because dynamic field is not indexed.
method: POST
Expand Down

0 comments on commit dcfab3c

Please sign in to comment.