@@ -945,6 +945,7 @@ impl DatasetIndexInternalExt for Dataset {
945
945
#[ cfg( test) ]
946
946
mod tests {
947
947
use crate :: dataset:: builder:: DatasetBuilder ;
948
+ use crate :: dataset:: optimize:: { compact_files, CompactionOptions } ;
948
949
use crate :: utils:: test:: { DatagenExt , FragmentCount , FragmentRowCount } ;
949
950
950
951
use super :: * ;
@@ -1556,6 +1557,32 @@ mod tests {
1556
1557
1557
1558
assert_eq ! ( texts. len( ) , 1 , "query: {}, texts: {:?}" , word, texts) ;
1558
1559
assert_eq ! ( texts[ 0 ] , word, "query: {}, texts: {:?}" , word, texts) ;
1560
+
1561
+ // we should be able to query the new words after compaction
1562
+ compact_files ( & mut dataset, CompactionOptions :: default ( ) , None )
1563
+ . await
1564
+ . unwrap ( ) ;
1565
+ for & word in uppercase_words. iter ( ) {
1566
+ let query_result = dataset
1567
+ . scan ( )
1568
+ . project ( & [ "text" ] )
1569
+ . unwrap ( )
1570
+ . full_text_search ( FullTextSearchQuery :: new ( word. to_string ( ) ) )
1571
+ . unwrap ( )
1572
+ . try_into_batch ( )
1573
+ . await
1574
+ . unwrap ( ) ;
1575
+ let texts = query_result[ "text" ]
1576
+ . as_string :: < i32 > ( )
1577
+ . iter ( )
1578
+ . map ( |v| match v {
1579
+ None => "" . to_string ( ) ,
1580
+ Some ( v) => v. to_string ( ) ,
1581
+ } )
1582
+ . collect :: < Vec < String > > ( ) ;
1583
+ assert_eq ! ( texts. len( ) , 1 , "query: {}, texts: {:?}" , word, texts) ;
1584
+ assert_eq ! ( texts[ 0 ] , word, "query: {}, texts: {:?}" , word, texts) ;
1585
+ }
1559
1586
}
1560
1587
}
1561
1588
0 commit comments