From fd8360deb12e0cd3ff258bf68c6afb142c49a8a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Sun, 15 Nov 2020 11:06:51 +0100 Subject: [PATCH] Update the facet indexing facet test --- src/update/settings.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/update/settings.rs b/src/update/settings.rs index 03f184ef6..141abcf00 100644 --- a/src/update/settings.rs +++ b/src/update/settings.rs @@ -412,6 +412,21 @@ mod tests { let rtxn = index.read_txn().unwrap(); let fields_ids = index.faceted_fields(&rtxn).unwrap(); assert_eq!(fields_ids, hashmap!{ 1 => FacetType::Integer }); + let count = index.facet_field_id_value_docids.len(&rtxn).unwrap(); + assert_eq!(count, 3); + drop(rtxn); + + // Index a little more documents with new and current facets values. + let mut wtxn = index.write_txn().unwrap(); + let content = &b"name,age\nkevin2,23\nkevina2,21\nbenoit2,35\n"[..]; + let mut builder = IndexDocuments::new(&mut wtxn, &index); + builder.update_format(UpdateFormat::Csv); + builder.execute(content, |_| ()).unwrap(); + wtxn.commit().unwrap(); + + let rtxn = index.read_txn().unwrap(); + let count = index.facet_field_id_value_docids.len(&rtxn).unwrap(); + assert_eq!(count, 4); drop(rtxn); } }