66using ZoneTree . FullTextSearch . Model ;
77using ZoneTree . FullTextSearch . QueryLanguage ;
88using ZoneTree . FullTextSearch . Search ;
9+ using ZoneTree . FullTextSearch . SearchEngines ;
910
1011namespace ZoneTree . FullTextSearch . Index ;
1112
@@ -91,33 +92,26 @@ public bool IsReadOnly
9192 /// Initializes a new instance of the <see cref="IndexOfTokenRecordPreviousToken{TRecord, TToken}"/> class,
9293 /// with the option to configure primary and secondary zone trees.
9394 /// </summary>
95+ /// <param name="dataPath">The path to the data storage, defaulting to "data".</param>
9496 /// <param name="recordComparer">The comparer of record.</param>
9597 /// <param name="tokenComparer">The comparer of token.</param>
96- /// <param name="useSecondaryIndex">Indicates whether a secondary index should be used to perform faster deletion.</param>
97- /// <param name="dataPath">The path to the data storage, defaulting to "data".</param>
98- /// <param name="configure1">Optional configuration action for the primary zone tree.</param>
99- /// <param name="configure2">Optional configuration action for the secondary zone tree.</param>
98+ /// <param name="useSecondaryIndex">Indicates whether a secondary index should be used to perform faster deletion.</param>
10099 /// <param name="blockCacheLifeTimeInMilliseconds">Defines the life time of cached blocks. Default is 1 minute.</param>
100+ /// /// <param name="advancedOptions">Advanced ZoneTree Options enabling customization of underlying ZoneTree instances.</param>
101101 public IndexOfTokenRecordPreviousToken (
102102 string dataPath = "data" ,
103103 IRefComparer < TRecord > recordComparer = null ,
104104 IRefComparer < TToken > tokenComparer = null ,
105105 bool useSecondaryIndex = false ,
106- Action <
107- ZoneTreeFactory <
108- CompositeKeyOfTokenRecordPrevious < TRecord , TToken > ,
109- byte > > configure1 = null ,
110- Action <
111- ZoneTreeFactory <
112- CompositeKeyOfRecordToken < TRecord , TToken > ,
113- byte > > configure2 = null ,
114- long blockCacheLifeTimeInMilliseconds = 60_000 )
106+ long blockCacheLifeTimeInMilliseconds = 60_000 ,
107+ AdvancedZoneTreeOptions < TRecord , TToken > advancedOptions = null )
115108 {
116109 if ( recordComparer == null )
117110 recordComparer = ComponentsForKnownTypes . GetComparer < TRecord > ( ) ;
118111 if ( tokenComparer == null )
119112 tokenComparer = ComponentsForKnownTypes . GetComparer < TToken > ( ) ;
120- var factory1 = new ZoneTreeFactory < CompositeKeyOfTokenRecordPrevious < TRecord , TToken > , byte > ( )
113+ var fileStreamProvider = advancedOptions ? . FileStreamProvider ;
114+ var factory1 = new ZoneTreeFactory < CompositeKeyOfTokenRecordPrevious < TRecord , TToken > , byte > ( fileStreamProvider )
121115 . SetDataDirectory ( $ "{ dataPath } /index1")
122116 . SetIsDeletedDelegate (
123117 ( in CompositeKeyOfTokenRecordPrevious < TRecord , TToken > key , in byte value ) => value == 1 )
@@ -128,7 +122,7 @@ public IndexOfTokenRecordPreviousToken(
128122 recordComparer ,
129123 tokenComparer ) ) ;
130124
131- configure1 ? . Invoke ( factory1 ) ;
125+ advancedOptions ? . FactoryConfigurator1 ? . Invoke ( factory1 ) ;
132126
133127 ZoneTree1 = factory1 . OpenOrCreate ( ) ;
134128 Maintainer1 = ZoneTree1 . CreateMaintainer ( ) ;
@@ -141,7 +135,7 @@ public IndexOfTokenRecordPreviousToken(
141135 this . useSecondaryIndex = useSecondaryIndex ;
142136 if ( useSecondaryIndex )
143137 {
144- var factory2 = new ZoneTreeFactory < CompositeKeyOfRecordToken < TRecord , TToken > , byte > ( )
138+ var factory2 = new ZoneTreeFactory < CompositeKeyOfRecordToken < TRecord , TToken > , byte > ( fileStreamProvider )
145139 . SetDataDirectory ( $ "{ dataPath } /index2")
146140 . SetIsDeletedDelegate (
147141 ( in CompositeKeyOfRecordToken < TRecord , TToken > key , in byte value ) => value == 1 )
@@ -152,7 +146,7 @@ public IndexOfTokenRecordPreviousToken(
152146 recordComparer ,
153147 tokenComparer ) ) ;
154148
155- configure2 ? . Invoke ( factory2 ) ;
149+ advancedOptions ? . FactoryConfigurator2 ? . Invoke ( factory2 ) ;
156150
157151 ZoneTree2 = factory2 . OpenOrCreate ( ) ;
158152 Maintainer2 = ZoneTree2 . CreateMaintainer ( ) ;
0 commit comments