()
| 157 | |
| 158 | #[test] |
| 159 | fn small_doc_uses_flat() { |
| 160 | let mut map = serde_json::Map::new(); |
| 161 | for i in 0..10 { |
| 162 | map.insert(format!("f{i}"), json!(i)); |
| 163 | } |
| 164 | let buf = encode(&serde_json::Value::Object(map)); |
| 165 | let idx = FieldIndex::build(&buf, 0).unwrap(); |
| 166 | assert_eq!(idx.len(), 10); |
| 167 | assert!(matches!(idx.inner, IndexInner::Flat(_))); |
| 168 | } |
| 169 | |
| 170 | #[test] |
| 171 | fn large_doc_uses_hashmap() { |