File tree Expand file tree Collapse file tree
crates/paimon/src/ftindex Expand file tree Collapse file tree Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments