@@ -36,16 +36,17 @@ mod passthrough_impl {
3636 use crate :: durability:: { DurableSearch , ExtendedGuest } ;
3737 use crate :: golem:: search:: core:: { Guest , SearchStream } ;
3838 use crate :: golem:: search:: types:: {
39- Doc , DocumentId , IndexName , Schema , SearchError , SearchQuery , SearchResults ,
39+ CreateIndexOptions , Doc , DocumentId , IndexName , Schema , SearchError , SearchQuery ,
40+ SearchResults ,
4041 } ;
4142 use crate :: init_logging;
4243
4344 impl < Impl : ExtendedGuest > Guest for DurableSearch < Impl > {
4445 type SearchStream = Impl :: SearchStream ;
4546
46- fn create_index ( name : IndexName , schema : Option < Schema > ) -> Result < ( ) , SearchError > {
47+ fn create_index ( options : CreateIndexOptions ) -> Result < ( ) , SearchError > {
4748 init_logging ( ) ;
48- Impl :: create_index ( name , schema )
49+ Impl :: create_index ( options )
4950 }
5051
5152 fn delete_index ( name : IndexName ) -> Result < ( ) , SearchError > {
@@ -111,7 +112,7 @@ mod passthrough_impl {
111112#[ cfg( feature = "durability" ) ]
112113mod durable_impl {
113114 use crate :: durability:: { DurableSearch , ExtendedGuest } ;
114- use crate :: golem:: search:: core:: { Guest , GuestSearchStream , SearchStream } ;
115+ use crate :: golem:: search:: core:: { CreateIndexOptions , Guest , GuestSearchStream , SearchStream } ;
115116 use crate :: golem:: search:: types:: {
116117 Doc , DocumentId , IndexName , Schema , SearchError , SearchHit , SearchQuery , SearchResults ,
117118 } ;
@@ -125,12 +126,6 @@ mod durable_impl {
125126 use std:: cell:: RefCell ;
126127 use std:: fmt:: { Display , Formatter } ;
127128
128- #[ derive( Debug , Clone , IntoValue ) ]
129- struct CreateIndexInput {
130- name : IndexName ,
131- schema : Option < Schema > ,
132- }
133-
134129 #[ derive( Debug , Clone , IntoValue ) ]
135130 struct DeleteIndexInput {
136131 name : IndexName ,
@@ -227,7 +222,7 @@ mod durable_impl {
227222 impl < Impl : ExtendedGuest > Guest for DurableSearch < Impl > {
228223 type SearchStream = DurableSearchStream < Impl > ;
229224
230- fn create_index ( name : IndexName , schema : Option < Schema > ) -> Result < ( ) , SearchError > {
225+ fn create_index ( options : CreateIndexOptions ) -> Result < ( ) , SearchError > {
231226 init_logging ( ) ;
232227
233228 let durability = Durability :: < NoOutput , SearchError > :: new (
@@ -237,11 +232,9 @@ mod durable_impl {
237232 ) ;
238233 if durability. is_live ( ) {
239234 let result = with_persistence_level ( PersistenceLevel :: PersistNothing , || {
240- Impl :: create_index ( name . clone ( ) , schema . clone ( ) ) . map ( |( ) | NoOutput )
235+ Impl :: create_index ( options . clone ( ) ) . map ( |( ) | NoOutput )
241236 } ) ;
242- durability
243- . persist ( CreateIndexInput { name, schema } , result)
244- . map ( |_: NoOutput | ( ) )
237+ durability. persist ( options, result) . map ( |_: NoOutput | ( ) )
245238 } else {
246239 durability. replay ( ) . map ( |_: NoOutput | ( ) )
247240 }
0 commit comments