{"record":{"id":"04beec7bf353ed96","repo":"quickwit-oss/tantivy","slug":"facet-support-in-dynamic-fields-is-not-yet-impleme-04beec","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/fastfield/writer.rs","lineNumber":338,"sourceCode":"                    json_path_writer.as_str(),\n                    NumericalValue::from(val),\n                );\n            }\n            ReferenceValueLeaf::F64(val) => {\n                columnar_writer.record_numerical(\n                    doc,\n                    json_path_writer.as_str(),\n                    NumericalValue::from(val),\n                );\n            }\n            ReferenceValueLeaf::Bool(val) => {\n                columnar_writer.record_bool(doc, json_path_writer.as_str(), val);\n            }\n            ReferenceValueLeaf::Date(val) => {\n                columnar_writer.record_datetime(doc, json_path_writer.as_str(), val);\n            }\n            ReferenceValueLeaf::Facet(_) => {\n                unimplemented!(\"Facet support in dynamic fields is not yet implemented\")\n            }\n            ReferenceValueLeaf::Bytes(_) => {\n                // TODO: This can be re added once it is added to the JSON Utils section as well.\n                // columnar_writer.record_bytes(doc, json_path_writer.as_str(), val);\n                unimplemented!(\"Bytes 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::PreTokStr(_) => {\n                unimplemented!(\n                    \"Pre-tokenized string support in dynamic fields is not yet implemented\"\n                )\n            }\n            ReferenceValueLeaf::Custom(_) => {\n                unimplemented!(\"the JSON field does not support custom field types\")\n            }\n        },","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/quickwit-oss/tantivy/blob/b5d8deb80c26924e6b007a5b1a7630f35ca64de4/src/fastfield/writer.rs#L320-L356","documentation":"record_json_value_to_columnar_writer records JSON leaves into a columnar (fast-field) writer and panics with unimplemented!() for Facet leaves. Facet values cannot yet be stored as fast-field columns for dynamic JSON fields; facets must use schema-declared facet fields.","triggerScenarios":"Writing a segment that contains a dynamic JSON field whose value is a Facet leaf — reached via record_json_obj_to_columnar_writer during segment writing.","commonSituations":"Indexing JSON documents containing facet-typed values; migrating facet fields into dynamic JSON fields.","solutions":["Declare the field with FacetOptions in the schema so facets bypass the JSON columnar path","Convert facet paths to plain strings in the JSON field if aggregation is not needed","Remove facet values from dynamic JSON documents before indexing"],"exampleFix":"// before\njson_obj.insert(\"tags\", Value::Facet(facet));\n// after\nlet tags = schema_builder.add_facet_field(\"tags\", FacetOptions::default());","handlingStrategy":"validation","validationCode":"fn json_obj_has_facet_leaves(obj: &tantivy::schema::OwnedValue) -> bool {\n    // facets must be indexed via schema-declared facet fields, not dynamic JSON\n    matches!(obj, tantivy::schema::OwnedValue::Facet(_))\n}\n// screen values before add_document","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(|| writer.commit()));\nif result.is_err() { eprintln!(\"segment write failed: facet inside dynamic JSON fast fields\"); }","preventionTips":["Declare facet fields with FacetOptions so they bypass the columnar JSON path","Validate JSON documents for typed leaves before writing segments","Track tantivy issues for facet-in-JSON support before enabling it","Separate facet and JSON fields in schema design"],"tags":["rust","unimplemented","facets","fast-fields","columnar"],"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"}