Skip to content

Commit 81ded62

Browse files
committed
test(ftindex): cover the roaring include-filter search path
1 parent 97ac666 commit 81ded62

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

crates/paimon/src/ftindex/reader.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,27 @@ mod tests {
138138
assert_eq!(ids, vec![0, 1]);
139139
assert_eq!(hits.scores.len(), hits.row_ids.len());
140140
}
141+
142+
#[tokio::test]
143+
async fn test_search_with_include_restricts_to_allow_list() {
144+
let bytes = build_archive(&[
145+
(0, "shared token here"),
146+
(1, "shared token here"),
147+
(2, "shared token here"),
148+
]);
149+
let input = archive_input(bytes).await;
150+
let reader = FullTextArchiveReader::from_input_file(&input).await.unwrap();
151+
152+
// All three match, but restrict to row-ids {0, 2}.
153+
let mut include = roaring::RoaringTreemap::new();
154+
include.insert(0);
155+
include.insert(2);
156+
157+
let hits = reader
158+
.search_with_include(r#"{"match":{"query":"token"}}"#, 10, include)
159+
.unwrap();
160+
let mut ids = hits.row_ids.clone();
161+
ids.sort_unstable();
162+
assert_eq!(ids, vec![0, 2]);
163+
}
141164
}

0 commit comments

Comments
 (0)