@@ -62,10 +62,12 @@ public class TextField : Field
62
62
public bool Unf { get ; }
63
63
public bool NoIndex { get ; }
64
64
public bool WithSuffixTrie { get ; }
65
+ public bool MissingIndex { get ; }
66
+ public bool EmptyIndex { get ; }
65
67
66
68
public TextField ( FieldName name , double weight = 1.0 , bool noStem = false ,
67
69
string ? phonetic = null , bool sortable = false , bool unf = false ,
68
- bool noIndex = false , bool withSuffixTrie = false )
70
+ bool noIndex = false , bool withSuffixTrie = false , bool missingIndex = false , bool emptyIndex = false )
69
71
: base ( name , FieldType . Text )
70
72
{
71
73
Weight = weight ;
@@ -79,12 +81,14 @@ public TextField(FieldName name, double weight = 1.0, bool noStem = false,
79
81
Unf = unf ;
80
82
NoIndex = noIndex ;
81
83
WithSuffixTrie = withSuffixTrie ;
84
+ MissingIndex = missingIndex ;
85
+ EmptyIndex = emptyIndex ;
82
86
}
83
87
84
88
public TextField ( string name , double weight = 1.0 , bool noStem = false ,
85
89
string ? phonetic = null , bool sortable = false , bool unf = false ,
86
- bool noIndex = false , bool withSuffixTrie = false )
87
- : this ( FieldName . Of ( name ) , weight , noStem , phonetic , sortable , unf , noIndex , withSuffixTrie ) { }
90
+ bool noIndex = false , bool withSuffixTrie = false , bool missingIndex = false , bool emptyIndex = false )
91
+ : this ( FieldName . Of ( name ) , weight , noStem , phonetic , sortable , unf , noIndex , withSuffixTrie , missingIndex , emptyIndex ) { }
88
92
89
93
internal override void AddFieldTypeArgs ( List < object > args )
90
94
{
@@ -93,8 +97,11 @@ internal override void AddFieldTypeArgs(List<object> args)
93
97
AddPhonetic ( args ) ;
94
98
AddWeight ( args ) ;
95
99
if ( WithSuffixTrie ) args . Add ( SearchArgs . WITHSUFFIXTRIE ) ;
96
- if ( Sortable ) args . Add ( AttributeOptions . SORTABLE ) ;
100
+ if ( Sortable ) args . Add ( FieldOptions . SORTABLE ) ;
97
101
if ( Unf ) args . Add ( SearchArgs . UNF ) ;
102
+ if ( MissingIndex ) args . Add ( FieldOptions . INDEXMISSING ) ;
103
+ if ( EmptyIndex ) args . Add ( FieldOptions . INDEXEMPTY ) ;
104
+
98
105
}
99
106
100
107
private void AddWeight ( List < object > args )
@@ -124,10 +131,12 @@ public class TagField : Field
124
131
public string Separator { get ; }
125
132
public bool CaseSensitive { get ; }
126
133
public bool WithSuffixTrie { get ; }
134
+ public bool MissingIndex { get ; }
135
+ public bool EmptyIndex { get ; }
127
136
128
137
internal TagField ( FieldName name , bool sortable = false , bool unf = false ,
129
138
bool noIndex = false , string separator = "," ,
130
- bool caseSensitive = false , bool withSuffixTrie = false )
139
+ bool caseSensitive = false , bool withSuffixTrie = false , bool missingIndex = false , bool emptyIndex = false )
131
140
: base ( name , FieldType . Tag )
132
141
{
133
142
Sortable = sortable ;
@@ -136,12 +145,14 @@ internal TagField(FieldName name, bool sortable = false, bool unf = false,
136
145
Separator = separator ;
137
146
CaseSensitive = caseSensitive ;
138
147
WithSuffixTrie = withSuffixTrie ;
148
+ EmptyIndex = emptyIndex ;
149
+ MissingIndex = missingIndex ;
139
150
}
140
151
141
152
internal TagField ( string name , bool sortable = false , bool unf = false ,
142
153
bool noIndex = false , string separator = "," ,
143
- bool caseSensitive = false , bool withSuffixTrie = false )
144
- : this ( FieldName . Of ( name ) , sortable , unf , noIndex , separator , caseSensitive , withSuffixTrie ) { }
154
+ bool caseSensitive = false , bool withSuffixTrie = false , bool missingIndex = false , bool emptyIndex = false )
155
+ : this ( FieldName . Of ( name ) , sortable , unf , noIndex , separator , caseSensitive , withSuffixTrie , missingIndex , emptyIndex ) { }
145
156
146
157
internal override void AddFieldTypeArgs ( List < object > args )
147
158
{
@@ -154,29 +165,35 @@ internal override void AddFieldTypeArgs(List<object> args)
154
165
args . Add ( Separator ) ;
155
166
}
156
167
if ( CaseSensitive ) args . Add ( SearchArgs . CASESENSITIVE ) ;
157
- if ( Sortable ) args . Add ( AttributeOptions . SORTABLE ) ;
168
+ if ( Sortable ) args . Add ( FieldOptions . SORTABLE ) ;
158
169
if ( Unf ) args . Add ( SearchArgs . UNF ) ;
170
+ if ( MissingIndex ) args . Add ( FieldOptions . INDEXMISSING ) ;
171
+ if ( EmptyIndex ) args . Add ( FieldOptions . INDEXEMPTY ) ;
159
172
}
160
173
}
161
174
162
175
public class GeoField : Field
163
176
{
164
177
public bool Sortable { get ; }
165
178
public bool NoIndex { get ; }
166
- internal GeoField ( FieldName name , bool sortable = false , bool noIndex = false )
179
+ public bool MissingIndex { get ; }
180
+
181
+ internal GeoField ( FieldName name , bool sortable = false , bool noIndex = false , bool missingIndex = false )
167
182
: base ( name , FieldType . Geo )
168
183
{
169
184
Sortable = sortable ;
170
185
NoIndex = noIndex ;
186
+ MissingIndex = missingIndex ;
171
187
}
172
188
173
- internal GeoField ( string name , bool sortable = false , bool noIndex = false )
174
- : this ( FieldName . Of ( name ) , sortable , noIndex ) { }
189
+ internal GeoField ( string name , bool sortable = false , bool noIndex = false , bool missingIndex = false )
190
+ : this ( FieldName . Of ( name ) , sortable , noIndex , missingIndex ) { }
175
191
176
192
internal override void AddFieldTypeArgs ( List < object > args )
177
193
{
178
194
if ( NoIndex ) args . Add ( SearchArgs . NOINDEX ) ;
179
- if ( Sortable ) args . Add ( AttributeOptions . SORTABLE ) ;
195
+ if ( Sortable ) args . Add ( FieldOptions . SORTABLE ) ;
196
+ if ( MissingIndex ) args . Add ( FieldOptions . INDEXMISSING ) ;
180
197
}
181
198
182
199
}
@@ -196,40 +213,47 @@ public enum CoordinateSystem
196
213
SPHERICAL
197
214
}
198
215
private CoordinateSystem system { get ; }
216
+ public bool MissingIndex { get ; }
199
217
200
- internal GeoShapeField ( FieldName name , CoordinateSystem system )
218
+ internal GeoShapeField ( FieldName name , CoordinateSystem system , bool missingIndex = false )
201
219
: base ( name , FieldType . GeoShape )
202
220
{
203
221
this . system = system ;
222
+ MissingIndex = missingIndex ;
204
223
}
205
224
206
- internal GeoShapeField ( string name , CoordinateSystem system )
207
- : this ( FieldName . Of ( name ) , system ) { }
225
+ internal GeoShapeField ( string name , CoordinateSystem system , bool missingIndex = false )
226
+ : this ( FieldName . Of ( name ) , system , missingIndex ) { }
208
227
209
228
internal override void AddFieldTypeArgs ( List < object > args )
210
229
{
211
230
args . Add ( system . ToString ( ) ) ;
231
+ if ( MissingIndex ) args . Add ( FieldOptions . INDEXMISSING ) ;
212
232
}
213
233
}
214
234
215
235
public class NumericField : Field
216
236
{
217
237
public bool Sortable { get ; }
218
238
public bool NoIndex { get ; }
219
- internal NumericField ( FieldName name , bool sortable = false , bool noIndex = false )
239
+ public bool MissingIndex { get ; }
240
+
241
+ internal NumericField ( FieldName name , bool sortable = false , bool noIndex = false , bool missingIndex = false )
220
242
: base ( name , FieldType . Numeric )
221
243
{
222
244
Sortable = sortable ;
223
245
NoIndex = noIndex ;
246
+ MissingIndex = missingIndex ;
224
247
}
225
248
226
- internal NumericField ( string name , bool sortable = false , bool noIndex = false )
227
- : this ( FieldName . Of ( name ) , sortable , noIndex ) { }
249
+ internal NumericField ( string name , bool sortable = false , bool noIndex = false , bool missingIndex = false )
250
+ : this ( FieldName . Of ( name ) , sortable , noIndex , missingIndex ) { }
228
251
229
252
internal override void AddFieldTypeArgs ( List < object > args )
230
253
{
231
254
if ( NoIndex ) args . Add ( SearchArgs . NOINDEX ) ;
232
- if ( Sortable ) args . Add ( AttributeOptions . SORTABLE ) ;
255
+ if ( Sortable ) args . Add ( FieldOptions . SORTABLE ) ;
256
+ if ( MissingIndex ) args . Add ( FieldOptions . INDEXMISSING ) ;
233
257
}
234
258
235
259
}
@@ -244,15 +268,18 @@ public enum VectorAlgo
244
268
245
269
public VectorAlgo Algorithm { get ; }
246
270
public Dictionary < string , object > ? Attributes { get ; }
247
- public VectorField ( FieldName name , VectorAlgo algorithm , Dictionary < string , object > ? attributes = null )
271
+ public bool MissingIndex { get ; }
272
+
273
+ public VectorField ( FieldName name , VectorAlgo algorithm , Dictionary < string , object > ? attributes = null , bool missingIndex = false )
248
274
: base ( name , FieldType . Vector )
249
275
{
250
276
Algorithm = algorithm ;
251
277
Attributes = attributes ;
278
+ MissingIndex = missingIndex ;
252
279
}
253
280
254
- public VectorField ( string name , VectorAlgo algorithm , Dictionary < string , object > ? attributes = null )
255
- : this ( FieldName . Of ( name ) , algorithm , attributes ) { }
281
+ public VectorField ( string name , VectorAlgo algorithm , Dictionary < string , object > ? attributes = null , bool missingIndex = false )
282
+ : this ( FieldName . Of ( name ) , algorithm , attributes , missingIndex ) { }
256
283
257
284
internal override void AddFieldTypeArgs ( List < object > args )
258
285
{
@@ -267,6 +294,7 @@ internal override void AddFieldTypeArgs(List<object> args)
267
294
args . Add ( attribute . Value ) ;
268
295
}
269
296
}
297
+ if ( MissingIndex ) args . Add ( FieldOptions . INDEXMISSING ) ;
270
298
}
271
299
}
272
300
public List < Field > Fields { get ; } = new List < Field > ( ) ;
@@ -296,9 +324,9 @@ public Schema AddField(Field field)
296
324
/// <param name="withSuffixTrie">Keeps a suffix trie with all terms which match the suffix.</param>
297
325
/// <returns>The <see cref="Schema"/> object.</returns>
298
326
public Schema AddTextField ( string name , double weight = 1.0 , bool sortable = false , bool unf = false , bool noStem = false ,
299
- string ? phonetic = null , bool noIndex = false , bool withSuffixTrie = false )
327
+ string ? phonetic = null , bool noIndex = false , bool withSuffixTrie = false , bool missingIndex = false , bool emptyIndex = false )
300
328
{
301
- Fields . Add ( new TextField ( name , weight , noStem , phonetic , sortable , unf , noIndex , withSuffixTrie ) ) ;
329
+ Fields . Add ( new TextField ( name , weight , noStem , phonetic , sortable , unf , noIndex , withSuffixTrie , missingIndex , emptyIndex ) ) ;
302
330
return this ;
303
331
}
304
332
@@ -316,9 +344,9 @@ public Schema AddTextField(string name, double weight = 1.0, bool sortable = fal
316
344
/// <param name="withSuffixTrie">Keeps a suffix trie with all terms which match the suffix.</param>
317
345
/// <returns>The <see cref="Schema"/> object.</returns>
318
346
public Schema AddTextField ( FieldName name , double weight = 1.0 , bool sortable = false , bool unf = false , bool noStem = false ,
319
- string ? phonetic = null , bool noIndex = false , bool withSuffixTrie = false )
347
+ string ? phonetic = null , bool noIndex = false , bool withSuffixTrie = false , bool missingIndex = false , bool emptyIndex = false )
320
348
{
321
- Fields . Add ( new TextField ( name , weight , noStem , phonetic , sortable , unf , noIndex , withSuffixTrie ) ) ;
349
+ Fields . Add ( new TextField ( name , weight , noStem , phonetic , sortable , unf , noIndex , withSuffixTrie , missingIndex , emptyIndex ) ) ;
322
350
return this ;
323
351
}
324
352
@@ -328,9 +356,9 @@ public Schema AddTextField(FieldName name, double weight = 1.0, bool sortable =
328
356
/// <param name="name">The field's name.</param>
329
357
/// <param name="system">The coordinate system to use.</param>
330
358
/// <returns>The <see cref="Schema"/> object.</returns>
331
- public Schema AddGeoShapeField ( string name , CoordinateSystem system )
359
+ public Schema AddGeoShapeField ( string name , CoordinateSystem system , bool missingIndex = false )
332
360
{
333
- Fields . Add ( new GeoShapeField ( name , system ) ) ;
361
+ Fields . Add ( new GeoShapeField ( name , system , missingIndex ) ) ;
334
362
return this ;
335
363
}
336
364
@@ -340,9 +368,9 @@ public Schema AddGeoShapeField(string name, CoordinateSystem system)
340
368
/// <param name="name">The field's name.</param>
341
369
/// <param name="system">The coordinate system to use.</param>
342
370
/// <returns>The <see cref="Schema"/> object.</returns>
343
- public Schema AddGeoShapeField ( FieldName name , CoordinateSystem system )
371
+ public Schema AddGeoShapeField ( FieldName name , CoordinateSystem system , bool missingIndex = false )
344
372
{
345
- Fields . Add ( new GeoShapeField ( name , system ) ) ;
373
+ Fields . Add ( new GeoShapeField ( name , system , missingIndex ) ) ;
346
374
return this ;
347
375
}
348
376
@@ -353,9 +381,9 @@ public Schema AddGeoShapeField(FieldName name, CoordinateSystem system)
353
381
/// <param name="sortable">If true, the text field can be sorted.</param>
354
382
/// <param name="noIndex">Attributes can have the NOINDEX option, which means they will not be indexed.</param>
355
383
/// <returns>The <see cref="Schema"/> object.</returns>
356
- public Schema AddGeoField ( FieldName name , bool sortable = false , bool noIndex = false )
384
+ public Schema AddGeoField ( FieldName name , bool sortable = false , bool noIndex = false , bool missingIndex = false )
357
385
{
358
- Fields . Add ( new GeoField ( name , sortable , noIndex ) ) ;
386
+ Fields . Add ( new GeoField ( name , sortable , noIndex , missingIndex ) ) ;
359
387
return this ;
360
388
}
361
389
@@ -366,9 +394,9 @@ public Schema AddGeoField(FieldName name, bool sortable = false, bool noIndex =
366
394
/// <param name="sortable">If true, the text field can be sorted.</param>
367
395
/// <param name="noIndex">Attributes can have the NOINDEX option, which means they will not be indexed.</param>
368
396
/// <returns>The <see cref="Schema"/> object.</returns>
369
- public Schema AddGeoField ( string name , bool sortable = false , bool noIndex = false )
397
+ public Schema AddGeoField ( string name , bool sortable = false , bool noIndex = false , bool missingIndex = false )
370
398
{
371
- Fields . Add ( new GeoField ( name , sortable , noIndex ) ) ;
399
+ Fields . Add ( new GeoField ( name , sortable , noIndex , missingIndex ) ) ;
372
400
return this ;
373
401
}
374
402
@@ -379,9 +407,9 @@ public Schema AddGeoField(string name, bool sortable = false, bool noIndex = fal
379
407
/// <param name="sortable">If true, the text field can be sorted.</param>
380
408
/// <param name="noIndex">Attributes can have the NOINDEX option, which means they will not be indexed.</param>
381
409
/// <returns>The <see cref="Schema"/> object.</returns>
382
- public Schema AddNumericField ( FieldName name , bool sortable = false , bool noIndex = false )
410
+ public Schema AddNumericField ( FieldName name , bool sortable = false , bool noIndex = false , bool missingIndex = false )
383
411
{
384
- Fields . Add ( new NumericField ( name , sortable , noIndex ) ) ;
412
+ Fields . Add ( new NumericField ( name , sortable , noIndex , missingIndex ) ) ;
385
413
return this ;
386
414
}
387
415
@@ -392,9 +420,9 @@ public Schema AddNumericField(FieldName name, bool sortable = false, bool noInde
392
420
/// <param name="sortable">If true, the text field can be sorted.</param>
393
421
/// <param name="noIndex">Attributes can have the NOINDEX option, which means they will not be indexed.</param>
394
422
/// <returns>The <see cref="Schema"/> object.</returns>
395
- public Schema AddNumericField ( string name , bool sortable = false , bool noIndex = false )
423
+ public Schema AddNumericField ( string name , bool sortable = false , bool noIndex = false , bool missingIndex = false )
396
424
{
397
- Fields . Add ( new NumericField ( name , sortable , noIndex ) ) ;
425
+ Fields . Add ( new NumericField ( name , sortable , noIndex , missingIndex ) ) ;
398
426
return this ;
399
427
}
400
428
@@ -412,9 +440,9 @@ public Schema AddNumericField(string name, bool sortable = false, bool noIndex =
412
440
/// <returns>The <see cref="Schema"/> object.</returns>
413
441
public Schema AddTagField ( FieldName name , bool sortable = false , bool unf = false ,
414
442
bool noIndex = false , string separator = "," ,
415
- bool caseSensitive = false , bool withSuffixTrie = false )
443
+ bool caseSensitive = false , bool withSuffixTrie = false , bool missingIndex = false , bool emptyIndex = false )
416
444
{
417
- Fields . Add ( new TagField ( name , sortable , unf , noIndex , separator , caseSensitive , withSuffixTrie ) ) ;
445
+ Fields . Add ( new TagField ( name , sortable , unf , noIndex , separator , caseSensitive , withSuffixTrie , missingIndex , emptyIndex ) ) ;
418
446
return this ;
419
447
}
420
448
@@ -432,9 +460,9 @@ public Schema AddTagField(FieldName name, bool sortable = false, bool unf = fals
432
460
/// <returns>The <see cref="Schema"/> object.</returns>
433
461
public Schema AddTagField ( string name , bool sortable = false , bool unf = false ,
434
462
bool noIndex = false , string separator = "," ,
435
- bool caseSensitive = false , bool withSuffixTrie = false )
463
+ bool caseSensitive = false , bool withSuffixTrie = false , bool missingIndex = false , bool emptyIndex = false )
436
464
{
437
- Fields . Add ( new TagField ( name , sortable , unf , noIndex , separator , caseSensitive , withSuffixTrie ) ) ;
465
+ Fields . Add ( new TagField ( name , sortable , unf , noIndex , separator , caseSensitive , withSuffixTrie , missingIndex , emptyIndex ) ) ;
438
466
return this ;
439
467
}
440
468
@@ -445,9 +473,9 @@ public Schema AddTagField(string name, bool sortable = false, bool unf = false,
445
473
/// <param name="algorithm">The vector similarity algorithm to use.</param>
446
474
/// <param name="attribute">The algorithm attributes for the creation of the vector index.</param>
447
475
/// <returns>The <see cref="Schema"/> object.</returns>
448
- public Schema AddVectorField ( FieldName name , VectorAlgo algorithm , Dictionary < string , object > ? attributes = null )
476
+ public Schema AddVectorField ( FieldName name , VectorAlgo algorithm , Dictionary < string , object > ? attributes = null , bool missingIndex = false )
449
477
{
450
- Fields . Add ( new VectorField ( name , algorithm , attributes ) ) ;
478
+ Fields . Add ( new VectorField ( name , algorithm , attributes , missingIndex ) ) ;
451
479
return this ;
452
480
}
453
481
@@ -458,9 +486,9 @@ public Schema AddVectorField(FieldName name, VectorAlgo algorithm, Dictionary<st
458
486
/// <param name="algorithm">The vector similarity algorithm to use.</param>
459
487
/// <param name="attribute">The algorithm attributes for the creation of the vector index.</param>
460
488
/// <returns>The <see cref="Schema"/> object.</returns>
461
- public Schema AddVectorField ( string name , VectorAlgo algorithm , Dictionary < string , object > ? attributes = null )
489
+ public Schema AddVectorField ( string name , VectorAlgo algorithm , Dictionary < string , object > ? attributes = null , bool missingIndex = false )
462
490
{
463
- Fields . Add ( new VectorField ( name , algorithm , attributes ) ) ;
491
+ Fields . Add ( new VectorField ( name , algorithm , attributes , missingIndex ) ) ;
464
492
return this ;
465
493
}
466
494
}
0 commit comments