{"record":{"id":"de5cadfadfcfef64","repo":"quickwit-oss/tantivy","slug":"facet-support-in-dynamic-fields-is-not-yet-impleme","errorCode":null,"errorMessage":"Facet support in dynamic fields is not yet implemented","messagePattern":"Facet support in dynamic fields is not yet implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/json_utils.rs","lineNumber":225,"sourceCode":"                set_path_id(\n                    term_buffer,\n                    ctx.path_to_unordered_id\n                        .get_or_allocate_unordered_id(json_path_writer.as_str()),\n                );\n                let val = val.truncate(DATE_TIME_PRECISION_INDEXED);\n                term_buffer.append_type_and_fast_value(val);\n                postings_writer.subscribe(doc, 0u32, term_buffer, ctx);\n            }\n            ReferenceValueLeaf::PreTokStr(_) => {\n                unimplemented!(\n                    \"Pre-tokenized string support in dynamic fields is not yet implemented\"\n                )\n            }\n            ReferenceValueLeaf::Bytes(_) => {\n                unimplemented!(\"Bytes support in dynamic fields is not yet implemented\")\n            }\n            ReferenceValueLeaf::Facet(_) => {\n                unimplemented!(\"Facet support in dynamic fields is not yet implemented\")\n            }\n            ReferenceValueLeaf::IpAddr(_) => {\n                unimplemented!(\"IP address support in dynamic fields is not yet implemented\")\n            }\n            ReferenceValueLeaf::Custom(_) => {\n                unimplemented!(\"the JSON field does not support custom field types\")\n            }\n        },\n        ReferenceValue::Array(elements) => {\n            for val in elements {\n                index_json_value(\n                    doc,\n                    val,\n                    text_analyzer,\n                    term_buffer,\n                    json_path_writer,\n                    postings_writer,\n                    ctx,","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/quickwit-oss/tantivy/blob/b5d8deb80c26924e6b007a5b1a7630f35ca64de4/src/core/json_utils.rs#L207-L243","documentation":"index_json_value panics via unimplemented!() when a dynamically-typed JSON leaf is a Facet. Facet values are not yet supported inside dynamic JSON fields and must use a schema-declared facet field. The panic is an explicit not-implemented marker.","triggerScenarios":"Indexing a document where a JSON field's value is a tantivy Facet object via index_document.","commonSituations":"Mixing facet (hierarchical category) values into JSON documents; bulk-converting legacy documents with facet fields into dynamic JSON fields.","solutions":["Declare the field with FacetOptions in the schema and index facets there","Store facet paths as plain strings in the JSON field only if facet aggregation is not needed","Strip facet values from JSON documents before indexing"],"exampleFix":"// before\njson_obj.insert(\"category\", Value::Facet(facet));\n// after\nlet category = schema_builder.add_facet_field(\"category\", FacetOptions::default());","handlingStrategy":"validation","validationCode":"fn json_has_facet(v: &serde_json::Value) -> bool {\n    match v {\n        serde_json::Value::Array(a) => a.iter().any(json_has_facet),\n        serde_json::Value::Object(o) => o.values().any(json_has_facet),\n        _ => false,\n    }\n}\n// ensure facets are not inside JSON payloads: assert!(!json_has_facet(&doc_value));","typeGuard":"fn is_facet_leaf(v: &tantivy::schema::Value) -> bool {\n    matches!(v.as_value(), tantivy::schema::ReferenceValueLeaf::Facet(_))\n}","tryCatchPattern":"let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| index_writer.add_document(doc)));\nif result.is_err() { eprintln!(\"dynamic JSON field contained Facet\"); }","preventionTips":["Declare facet fields with FacetOptions instead of embedding in JSON","Store facet paths as plain strings in JSON if aggregation is unnecessary","Validate documents before indexing","Keep facet and JSON field usage separated by schema design"],"tags":["rust","unimplemented","json","facets","dynamic-fields"],"backgroundTag":"unimplemented-dynamic-field-type","analyzedSha":"b5d8deb80c26924e6b007a5b1a7630f35ca64de4","analyzedAt":"2026-09-05T13:20:51.521Z","contentChangedAt":"2026-09-05T13:20:51.521Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}