@@ -23,7 +23,10 @@ use common::{
2323 FuturesAsyncWriteCompatExt ,
2424 TokioAsyncWriteCompatExt ,
2525 } ,
26- bootstrap_model:: index:: vector_index:: FragmentedVectorSegment ,
26+ bootstrap_model:: index:: {
27+ text_index:: FragmentedTextSegment ,
28+ vector_index:: FragmentedVectorSegment ,
29+ } ,
2730 runtime:: Runtime ,
2831 types:: ObjectKey ,
2932} ;
@@ -66,6 +69,7 @@ use crate::{
6669 } ,
6770 SearchFileType ,
6871 TantivySearchIndexSchema ,
72+ TextSegmentPaths ,
6973} ;
7074
7175static SEARCH_INDEXING_MEMORY_ARENA_BYTES : LazyLock < usize > =
@@ -162,7 +166,54 @@ pub async fn download_single_file_zip<P: AsRef<Path>>(
162166 Ok ( ( ) )
163167}
164168
165- pub async fn upload_segment < RT : Runtime > (
169+ pub async fn upload_text_segment < RT : Runtime > (
170+ rt : & RT ,
171+ storage : Arc < dyn Storage > ,
172+ new_segment : TextSegmentPaths ,
173+ ) -> anyhow:: Result < FragmentedTextSegment > {
174+ let TextSegmentPaths {
175+ index_path,
176+ id_tracker_path,
177+ alive_bit_set_path,
178+ deleted_terms_path,
179+ } = new_segment;
180+ let upload_index =
181+ upload_index_archive_from_path ( index_path, storage. clone ( ) , SearchFileType :: Text ) ;
182+ let upload_id_tracker = upload_single_file_from_path (
183+ id_tracker_path,
184+ storage. clone ( ) ,
185+ SearchFileType :: TextIdTracker ,
186+ ) ;
187+ let upload_bitset = upload_single_file_from_path (
188+ alive_bit_set_path,
189+ storage. clone ( ) ,
190+ SearchFileType :: TextAliveBitset ,
191+ ) ;
192+ let upload_deleted_terms = upload_single_file_from_path (
193+ deleted_terms_path,
194+ storage. clone ( ) ,
195+ SearchFileType :: TextDeletedTerms ,
196+ ) ;
197+ let result = futures:: try_join!(
198+ upload_index,
199+ upload_id_tracker,
200+ upload_bitset,
201+ upload_deleted_terms
202+ ) ?;
203+ let ( segment_key, id_tracker_key, alive_bitset_key, deleted_terms_table_key) = result;
204+ Ok ( FragmentedTextSegment {
205+ segment_key,
206+ id_tracker_key,
207+ deleted_terms_table_key,
208+ alive_bitset_key,
209+ // TODO(sam): Wrap TextSegmentPaths in another struct with some metadata and pass it through
210+ // here.
211+ num_indexed_documents : 0 ,
212+ id : rt. new_uuid_v4 ( ) . to_string ( ) ,
213+ } )
214+ }
215+
216+ pub async fn upload_vector_segment < RT : Runtime > (
166217 rt : & RT ,
167218 storage : Arc < dyn Storage > ,
168219 new_segment : VectorDiskSegmentValues ,
0 commit comments