Fix one more

This commit is contained in:
Louis Dureuil 2024-11-20 11:35:01 +01:00 committed by Clément Renault
parent 2afa33011a
commit 4cdfdddd6d
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -25,10 +25,12 @@ fn test_facet_distribution_with_no_facet_values() {
S("tags"), S("tags"),
}); });
builder.execute(|_| (), || false).unwrap(); builder.execute(|_| (), || false).unwrap();
wtxn.commit().unwrap();
// index documents // index documents
let config = IndexerConfig { max_memory: Some(10 * 1024 * 1024), ..Default::default() }; let config = IndexerConfig { max_memory: Some(10 * 1024 * 1024), ..Default::default() };
let rtxn = index.read_txn().unwrap(); let rtxn = index.read_txn().unwrap();
let mut wtxn = index.write_txn().unwrap();
let db_fields_ids_map = index.fields_ids_map(&rtxn).unwrap(); let db_fields_ids_map = index.fields_ids_map(&rtxn).unwrap();
let mut new_fields_ids_map = db_fields_ids_map.clone(); let mut new_fields_ids_map = db_fields_ids_map.clone();
@ -66,13 +68,13 @@ fn test_facet_distribution_with_no_facet_values() {
wtxn.commit().unwrap(); wtxn.commit().unwrap();
let txn = index.read_txn().unwrap(); let rtxn = index.read_txn().unwrap();
let mut distrib = FacetDistribution::new(&txn, &index); let mut distrib = FacetDistribution::new(&rtxn, &index);
distrib.facets(vec![("genres", OrderBy::default())]); distrib.facets(vec![("genres", OrderBy::default())]);
let result = distrib.execute().unwrap(); let result = distrib.execute().unwrap();
assert_eq!(result["genres"].len(), 0); assert_eq!(result["genres"].len(), 0);
let mut distrib = FacetDistribution::new(&txn, &index); let mut distrib = FacetDistribution::new(&rtxn, &index);
distrib.facets(vec![("tags", OrderBy::default())]); distrib.facets(vec![("tags", OrderBy::default())]);
let result = distrib.execute().unwrap(); let result = distrib.execute().unwrap();
assert_eq!(result["tags"].len(), 2); assert_eq!(result["tags"].len(), 2);