6
6
using ZoneTree . FullTextSearch . Model ;
7
7
using ZoneTree . FullTextSearch . QueryLanguage ;
8
8
using ZoneTree . FullTextSearch . Search ;
9
+ using ZoneTree . FullTextSearch . SearchEngines ;
9
10
10
11
namespace ZoneTree . FullTextSearch . Index ;
11
12
@@ -91,33 +92,26 @@ public bool IsReadOnly
91
92
/// Initializes a new instance of the <see cref="IndexOfTokenRecordPreviousToken{TRecord, TToken}"/> class,
92
93
/// with the option to configure primary and secondary zone trees.
93
94
/// </summary>
95
+ /// <param name="dataPath">The path to the data storage, defaulting to "data".</param>
94
96
/// <param name="recordComparer">The comparer of record.</param>
95
97
/// <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>
100
99
/// <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>
101
101
public IndexOfTokenRecordPreviousToken (
102
102
string dataPath = "data" ,
103
103
IRefComparer < TRecord > recordComparer = null ,
104
104
IRefComparer < TToken > tokenComparer = null ,
105
105
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 )
115
108
{
116
109
if ( recordComparer == null )
117
110
recordComparer = ComponentsForKnownTypes . GetComparer < TRecord > ( ) ;
118
111
if ( tokenComparer == null )
119
112
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 )
121
115
. SetDataDirectory ( $ "{ dataPath } /index1")
122
116
. SetIsDeletedDelegate (
123
117
( in CompositeKeyOfTokenRecordPrevious < TRecord , TToken > key , in byte value ) => value == 1 )
@@ -128,7 +122,7 @@ public IndexOfTokenRecordPreviousToken(
128
122
recordComparer ,
129
123
tokenComparer ) ) ;
130
124
131
- configure1 ? . Invoke ( factory1 ) ;
125
+ advancedOptions ? . FactoryConfigurator1 ? . Invoke ( factory1 ) ;
132
126
133
127
ZoneTree1 = factory1 . OpenOrCreate ( ) ;
134
128
Maintainer1 = ZoneTree1 . CreateMaintainer ( ) ;
@@ -141,7 +135,7 @@ public IndexOfTokenRecordPreviousToken(
141
135
this . useSecondaryIndex = useSecondaryIndex ;
142
136
if ( useSecondaryIndex )
143
137
{
144
- var factory2 = new ZoneTreeFactory < CompositeKeyOfRecordToken < TRecord , TToken > , byte > ( )
138
+ var factory2 = new ZoneTreeFactory < CompositeKeyOfRecordToken < TRecord , TToken > , byte > ( fileStreamProvider )
145
139
. SetDataDirectory ( $ "{ dataPath } /index2")
146
140
. SetIsDeletedDelegate (
147
141
( in CompositeKeyOfRecordToken < TRecord , TToken > key , in byte value ) => value == 1 )
@@ -152,7 +146,7 @@ public IndexOfTokenRecordPreviousToken(
152
146
recordComparer ,
153
147
tokenComparer ) ) ;
154
148
155
- configure2 ? . Invoke ( factory2 ) ;
149
+ advancedOptions ? . FactoryConfigurator2 ? . Invoke ( factory2 ) ;
156
150
157
151
ZoneTree2 = factory2 . OpenOrCreate ( ) ;
158
152
Maintainer2 = ZoneTree2 . CreateMaintainer ( ) ;
0 commit comments