{"record":{"id":"09fc175a8e6e07af","repo":"quickwit-oss/tantivy","slug":"ip-address-support-in-dynamic-fields-is-not-yet-im","errorCode":null,"errorMessage":"IP address support in dynamic fields is not yet implemented","messagePattern":"IP address support in dynamic fields is not yet implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/json_utils.rs","lineNumber":228,"sourceCode":"                        .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,\n                    positions_per_path,\n                );\n            }","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/quickwit-oss/tantivy/blob/b5d8deb80c26924e6b007a5b1a7630f35ca64de4/src/core/json_utils.rs#L210-L246","documentation":"index_json_value panics via unimplemented!() when a dynamically-typed JSON leaf is an IpAddr. IP address values cannot be indexed within dynamic JSON fields yet; they require a schema-typed ip field. The panic is intentional.","triggerScenarios":"Indexing a document whose JSON field value is a tantivy IpAddr leaf via index_document.","commonSituations":"Putting IP-address typed values into JSON objects instead of strings; migrating typed ip fields into dynamic JSON fields.","solutions":["Declare an ip field in the schema (IpAddr options) and index the value there","Store the IP as its string representation (e.g. \"192.168.0.1\") in the JSON field","Remove the typed IP value from JSON documents before indexing"],"exampleFix":"// before\njson_obj.insert(\"client_ip\", Value::IpAddr(ip));\n// after\njson_obj.insert(\"client_ip\", Value::Str(ip.to_string()));","handlingStrategy":"validation","validationCode":"fn json_has_typed_ip(v: &serde_json::Value) -> bool {\n    // typed IpAddr leaves only come from tantivy values; string IPs are fine\n    match v {\n        serde_json::Value::Array(a) => a.iter().any(json_has_typed_ip),\n        serde_json::Value::Object(o) => o.values().any(json_has_typed_ip),\n        _ => false,\n    }\n}","typeGuard":"fn is_ip_leaf(v: &tantivy::schema::Value) -> bool {\n    matches!(v.as_value(), tantivy::schema::ReferenceValueLeaf::IpAddr(_))\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 typed IpAddr\"); }","preventionTips":["Store IPs as strings in JSON fields (e.g. \"10.0.0.1\")","Use schema-typed ip fields when IP fast-field/range queries are needed","Sanitize values before add_document","Review typed-value usage when refactoring to dynamic JSON fields"],"tags":["rust","unimplemented","json","ip-address","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"}