forked from ravendb/ravendb-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
document_query.go
657 lines (502 loc) · 23.2 KB
/
document_query.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
package ravendb
import (
"reflect"
"time"
)
type IDocumentQueryBase = DocumentQuery
type IDocumentQueryBaseSingle = DocumentQuery
type IDocumentQuery = DocumentQuery
type IFilterDocumentQueryBase = DocumentQuery
type DocumentQuery struct {
*AbstractDocumentQuery
}
func NewDocumentQueryOld(clazz reflect.Type, session *InMemoryDocumentSessionOperations, indexName string, collectionName string, isGroupBy bool) *DocumentQuery {
return &DocumentQuery{
AbstractDocumentQuery: NewAbstractDocumentQueryOld(clazz, session, indexName, collectionName, isGroupBy, nil, nil, ""),
}
}
func NewDocumentQueryWithTokenOld(clazz reflect.Type, session *InMemoryDocumentSessionOperations, indexName string, collectionName string, isGroupBy bool, declareToken *declareToken, loadTokens []*loadToken, fromAlias string) *DocumentQuery {
return &DocumentQuery{
AbstractDocumentQuery: NewAbstractDocumentQueryOld(clazz, session, indexName, collectionName, isGroupBy, declareToken, loadTokens, fromAlias),
}
}
func (q *DocumentQuery) SelectFields(projectionClass reflect.Type, fields ...string) *DocumentQuery {
if len(fields) > 0 {
queryData := NewQueryData(fields, fields)
return q.SelectFieldsWithQueryData(projectionClass, queryData)
}
projections := getJSONStructFieldNames(projectionClass)
newFields := projections // java re-does the same calculations
return q.SelectFieldsWithQueryData(projectionClass, NewQueryData(newFields, projections))
}
func (q *DocumentQuery) SelectFieldsWithQueryData(projectionClass reflect.Type, queryData *QueryData) *DocumentQuery {
return q.createDocumentQueryInternalWithQueryData(projectionClass, queryData)
}
func (q *DocumentQuery) Distinct() *DocumentQuery {
q._distinct()
return q
}
func (q *DocumentQuery) OrderByScore() *DocumentQuery {
q._orderByScore()
return q
}
func (q *DocumentQuery) OrderByScoreDescending() *DocumentQuery {
q._orderByScoreDescending()
return q
}
//TBD 4.1 IDocumentQuery<T> explainScores() {
func (q *DocumentQuery) WaitForNonStaleResults(waitTimeout time.Duration) *DocumentQuery {
q._waitForNonStaleResults(waitTimeout)
return q
}
func (q *DocumentQuery) AddParameter(name string, value Object) *IDocumentQuery {
q._addParameter(name, value)
return q
}
func (q *DocumentQuery) AddOrder(fieldName string, descending bool) *IDocumentQuery {
return q.AddOrderWithOrdering(fieldName, descending, OrderingType_STRING)
}
func (q *DocumentQuery) AddOrderWithOrdering(fieldName string, descending bool, ordering OrderingType) *IDocumentQuery {
if descending {
q.OrderByDescendingWithOrdering(fieldName, ordering)
} else {
q.OrderByWithOrdering(fieldName, ordering)
}
return q
}
//TBD expr IDocumentQuery<T> AddOrder<TValue>(Expression<Func<T, TValue>> propertySelector, bool descending, OrderingType ordering)
/*
IDocumentQuery<T> addAfterQueryExecutedListener(Consumer<QueryResult> action) {
_addAfterQueryExecutedListener(action);
return this;
}
IDocumentQuery<T> removeAfterQueryExecutedListener(Consumer<QueryResult> action) {
_removeAfterQueryExecutedListener(action);
return this;
}
IDocumentQuery<T> addAfterStreamExecutedListener(Consumer<ObjectNode> action) {
_addAfterStreamExecutedListener(action);
return this;
}
IDocumentQuery<T> removeAfterStreamExecutedListener(Consumer<ObjectNode> action) {
_removeAfterStreamExecutedListener(action);
return this;
}
*/
func (q *DocumentQuery) OpenSubclause() *IDocumentQuery {
q._openSubclause()
return q
}
func (q *DocumentQuery) CloseSubclause() *IDocumentQuery {
q._closeSubclause()
return q
}
func (q *DocumentQuery) Search(fieldName string, searchTerms string) *IDocumentQuery {
q._search(fieldName, searchTerms)
return q
}
func (q *DocumentQuery) SearchWithOperator(fieldName string, searchTerms string, operator SearchOperator) *IDocumentQuery {
q._searchWithOperator(fieldName, searchTerms, operator)
return q
}
//TBD expr IDocumentQuery<T> Search<TValue>(Expression<Func<T, TValue>> propertySelector, string searchTerms, SearchOperator @operator)
func (q *DocumentQuery) Intersect() *IDocumentQuery {
q._intersect()
return q
}
func (q *DocumentQuery) ContainsAny(fieldName string, values []Object) *DocumentQuery {
q._containsAny(fieldName, values)
return q
}
//TBD expr IDocumentQuery<T> ContainsAny<TValue>(Expression<Func<T, TValue>> propertySelector, IEnumerable<TValue> values)
func (q *DocumentQuery) ContainsAll(fieldName string, values []Object) *DocumentQuery {
q._containsAll(fieldName, values)
return q
}
//TBD expr IDocumentQuery<T> ContainsAll<TValue>(Expression<Func<T, TValue>> propertySelector, IEnumerable<TValue> values)
func (q *DocumentQuery) Statistics(stats **QueryStatistics) *DocumentQuery {
q._statistics(stats)
return q
}
func (q *DocumentQuery) UsingDefaultOperator(queryOperator QueryOperator) *IDocumentQuery {
q._usingDefaultOperator(queryOperator)
return q
}
func (q *DocumentQuery) NoTracking() *IDocumentQuery {
q._noTracking()
return q
}
func (q *DocumentQuery) NoCaching() *IDocumentQuery {
q._noCaching()
return q
}
//TBD 4.1 IDocumentQuery<T> showTimings()
func (q *DocumentQuery) Include(path string) *IDocumentQuery {
q._include(path)
return q
}
//TBD expr IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.Include(Expression<Func<T, object>> path)
func (q *DocumentQuery) Not() *DocumentQuery {
q.NegateNext()
return q
}
func (q *DocumentQuery) Take(count int) *DocumentQuery {
q._take(&count)
return q
}
func (q *DocumentQuery) Skip(count int) *DocumentQuery {
q._skip(count)
return q
}
func (q *DocumentQuery) WhereLucene(fieldName string, whereClause string) *IDocumentQuery {
q._whereLucene(fieldName, whereClause)
return q
}
func (q *DocumentQuery) WhereEquals(fieldName string, value Object) *DocumentQuery {
q._whereEquals(fieldName, value)
return q
}
// Exact marks previous Where statement (e.g. WhereEquals or WhereLucene) as exact
func (q *DocumentQuery) Exact() *DocumentQuery {
q.markLastTokenExact()
return q
}
func (q *DocumentQuery) WhereEqualsWithMethodCall(fieldName string, method MethodCall) *DocumentQuery {
q._whereEqualsWithMethodCall(fieldName, method)
return q
}
//TBD expr IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.WhereEquals<TValue>(Expression<Func<T, TValue>> propertySelector, TValue value, bool exact)
//TBD expr IDocumentQuery<T> IFilterDocumentQueryBase<T, IDocumentQuery<T>>.WhereEquals<TValue>(Expression<Func<T, TValue>> propertySelector, MethodCall value, bool exact)
func (q *DocumentQuery) WhereEqualsWithParams(whereParams *whereParams) *DocumentQuery {
q._whereEqualsWithParams(whereParams)
return q
}
func (q *DocumentQuery) WhereNotEquals(fieldName string, value Object) *DocumentQuery {
q._whereNotEquals(fieldName, value)
return q
}
func (q *DocumentQuery) _whereNotEqualsWithMethod(fieldName string, method MethodCall) *DocumentQuery {
q._whereNotEqualsWithMethod(fieldName, method)
return q
}
//TBD expr IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.WhereNotEquals<TValue>(Expression<Func<T, TValue>> propertySelector, TValue value, bool exact)
//TBD expr IDocumentQuery<T> IFilterDocumentQueryBase<T, IDocumentQuery<T>>.WhereNotEquals<TValue>(Expression<Func<T, TValue>> propertySelector, MethodCall value, bool exact)
func (q *DocumentQuery) WhereNotEqualsWithParams(whereParams *whereParams) *DocumentQuery {
q._whereNotEqualsWithParams(whereParams)
return q
}
func (q *DocumentQuery) WhereIn(fieldName string, values []Object) *DocumentQuery {
q._whereIn(fieldName, values)
return q
}
//TBD expr IDocumentQuery<T> WhereIn<TValue>(Expression<Func<T, TValue>> propertySelector, IEnumerable<TValue> values, bool exact = false)
func (q *DocumentQuery) WhereStartsWith(fieldName string, value Object) *DocumentQuery {
q._whereStartsWith(fieldName, value)
return q
}
func (q *DocumentQuery) WhereEndsWith(fieldName string, value Object) *DocumentQuery {
q._whereEndsWith(fieldName, value)
return q
}
//TBD expr IDocumentQuery<T> WhereEndsWith<TValue>(Expression<Func<T, TValue>> propertySelector, TValue value)
func (q *DocumentQuery) WhereBetween(fieldName string, start Object, end Object) *DocumentQuery {
q._whereBetween(fieldName, start, end)
return q
}
//TBD expr IDocumentQuery<T> WhereBetween<TValue>(Expression<Func<T, TValue>> propertySelector, TValue start, TValue end, bool exact = false)
func (q *DocumentQuery) WhereGreaterThan(fieldName string, value Object) *DocumentQuery {
q._whereGreaterThan(fieldName, value)
return q
}
func (q *DocumentQuery) WhereGreaterThanOrEqual(fieldName string, value Object) *DocumentQuery {
q._whereGreaterThanOrEqual(fieldName, value)
return q
}
//TBD expr IDocumentQuery<T> WhereGreaterThan<TValue>(Expression<Func<T, TValue>> propertySelector, TValue value, bool exact = false)
//TBD expr IDocumentQuery<T> WhereGreaterThanOrEqual<TValue>(Expression<Func<T, TValue>> propertySelector, TValue value, bool exact = false)
func (q *DocumentQuery) WhereLessThan(fieldName string, value Object) *DocumentQuery {
q._whereLessThan(fieldName, value)
return q
}
//TBD expr IDocumentQuery<T> WhereLessThanOrEqual<TValue>(Expression<Func<T, TValue>> propertySelector, TValue value, bool exact = false)
func (q *DocumentQuery) WhereLessThanOrEqual(fieldName string, value Object) *DocumentQuery {
q._whereLessThanOrEqual(fieldName, value)
return q
}
//TBD expr IDocumentQuery<T> WhereLessThanOrEqual<TValue>(Expression<Func<T, TValue>> propertySelector, TValue value, bool exact = false)
//TBD expr IDocumentQuery<T> WhereExists<TValue>(Expression<Func<T, TValue>> propertySelector)
func (q *DocumentQuery) WhereExists(fieldName string) *DocumentQuery {
q._whereExists(fieldName)
return q
}
//TBD expr IDocumentQuery<T> IFilterDocumentQueryBase<T, IDocumentQuery<T>>.WhereRegex<TValue>(Expression<Func<T, TValue>> propertySelector, string pattern)
func (q *DocumentQuery) WhereRegex(fieldName string, pattern string) *DocumentQuery {
q._whereRegex(fieldName, pattern)
return q
}
func (q *DocumentQuery) AndAlso() *DocumentQuery {
q._andAlso()
return q
}
func (q *DocumentQuery) OrElse() *DocumentQuery {
q._orElse()
return q
}
func (q *DocumentQuery) Boost(boost float64) *DocumentQuery {
q._boost(boost)
return q
}
func (q *DocumentQuery) Fuzzy(fuzzy float64) *DocumentQuery {
q._fuzzy(fuzzy)
return q
}
func (q *DocumentQuery) Proximity(proximity int) *DocumentQuery {
q._proximity(proximity)
return q
}
func (q *DocumentQuery) RandomOrdering() *DocumentQuery {
q._randomOrdering()
return q
}
func (q *DocumentQuery) RandomOrderingWithSeed(seed string) *DocumentQuery {
q._randomOrderingWithSeed(seed)
return q
}
//TBD 4.1 IDocumentQuery<T> customSortUsing(string typeName, bool descending)
func (q *DocumentQuery) GroupBy(fieldName string, fieldNames ...string) *IGroupByDocumentQuery {
q._groupBy(fieldName, fieldNames...)
return NewGroupByDocumentQuery(q)
}
func (q *DocumentQuery) GroupBy2(field *GroupBy, fields ...*GroupBy) *IGroupByDocumentQuery {
q._groupBy2(field, fields...)
return NewGroupByDocumentQuery(q)
}
func (q *DocumentQuery) OfType(tResultClass reflect.Type) *IDocumentQuery {
return q.createDocumentQueryInternal(tResultClass)
}
func (q *DocumentQuery) OrderBy(field string) *IDocumentQuery {
return q.OrderByWithOrdering(field, OrderingType_STRING)
}
func (q *DocumentQuery) OrderByWithOrdering(field string, ordering OrderingType) *IDocumentQuery {
q._orderByWithOrdering(field, ordering)
return q
}
//TBD expr IDocumentQuery<T> OrderBy<TValue>(params Expression<Func<T, TValue>>[] propertySelectors)
func (q *DocumentQuery) OrderByDescending(field string) *IDocumentQuery {
return q.OrderByDescendingWithOrdering(field, OrderingType_STRING)
}
func (q *DocumentQuery) OrderByDescendingWithOrdering(field string, ordering OrderingType) *IDocumentQuery {
q._orderByDescendingWithOrdering(field, ordering)
return q
}
//TBD expr IDocumentQuery<T> OrderByDescending<TValue>(params Expression<Func<T, TValue>>[] propertySelectors)
/*
IDocumentQuery<T> addBeforeQueryExecutedListener(Consumer<IndexQuery> action) {
_addBeforeQueryExecutedListener(action);
return this;
}
IDocumentQuery<T> removeBeforeQueryExecutedListener(Consumer<IndexQuery> action) {
_removeBeforeQueryExecutedListener(action);
return this;
}
*/
func (q *DocumentQuery) createDocumentQueryInternal(resultClass reflect.Type) *DocumentQuery {
return q.createDocumentQueryInternalWithQueryData(resultClass, nil)
}
func (q *DocumentQuery) createDocumentQueryInternalWithQueryData(resultClass reflect.Type, queryData *QueryData) *DocumentQuery {
var newFieldsToFetch *fieldsToFetchToken
if queryData != nil && len(queryData.getFields()) > 0 {
fields := queryData.getFields()
identityProperty := q.GetConventions().GetIdentityProperty(resultClass)
if identityProperty != "" {
// make a copy, just in case, because we might modify it
fields = append([]string{}, fields...)
for idx, p := range fields {
if p == identityProperty {
fields[idx] = Constants_Documents_Indexing_Fields_DOCUMENT_ID_FIELD_NAME
}
}
}
newFieldsToFetch = FieldsToFetchToken_create(fields, queryData.getProjections(), queryData.IsCustomFunction())
}
if newFieldsToFetch != nil {
q.updateFieldsToFetchToken(newFieldsToFetch)
}
var declareToken *declareToken
var loadTokens []*loadToken
var fromAlias string
if queryData != nil {
declareToken = queryData.getDeclareToken()
loadTokens = queryData.getLoadTokens()
fromAlias = queryData.getFromAlias()
}
query := NewDocumentQueryWithTokenOld(resultClass,
q.theSession,
q.GetIndexName(),
q.GetCollectionName(),
q.isGroupBy,
declareToken,
loadTokens,
fromAlias)
query.queryRaw = q.queryRaw
query.pageSize = q.pageSize
query.selectTokens = q.selectTokens
query.fieldsToFetchToken = q.fieldsToFetchToken
query.whereTokens = q.whereTokens
query.orderByTokens = q.orderByTokens
query.groupByTokens = q.groupByTokens
query.queryParameters = q.queryParameters
query.start = q.start
query.timeout = q.timeout
query.queryStats = q.queryStats
query.theWaitForNonStaleResults = q.theWaitForNonStaleResults
query.negate = q.negate
//noinspection unchecked
query.includes = StringArrayCopy(q.includes)
// TODO: should this be deep copy so that adding/removing in one
// doesn't affect the other?
query.beforeQueryExecutedCallback = q.beforeQueryExecutedCallback
query.afterQueryExecutedCallback = q.afterQueryExecutedCallback
query.afterStreamExecutedCallback = q.afterStreamExecutedCallback
query.disableEntitiesTracking = q.disableEntitiesTracking
query.disableCaching = q.disableCaching
//TBD 4.1 ShowQueryTimings = ShowQueryTimings,
//TBD 4.1 query.shouldExplainScores = shouldExplainScores;
query.isIntersect = q.isIntersect
query.defaultOperator = q.defaultOperator
return query
}
// TODO: rename to aggregateByBuilder and aggregateByFacet => aggregateBy
func (q *DocumentQuery) AggregateBy(builder func(IFacetBuilder)) *IAggregationDocumentQuery {
ff := NewFacetBuilder()
builder(ff)
return q.AggregateByFacet(ff.getFacet())
}
func (q *DocumentQuery) AggregateByFacet(facet FacetBase) *IAggregationDocumentQuery {
q._aggregateBy(facet)
return NewAggregationDocumentQuery(q)
}
func (q *DocumentQuery) AggregateByFacets(facets ...*Facet) *IAggregationDocumentQuery {
for _, facet := range facets {
q._aggregateBy(facet)
}
return NewAggregationDocumentQuery(q)
}
func (q *DocumentQuery) AggregateUsing(facetSetupDocumentId string) *IAggregationDocumentQuery {
q._aggregateUsing(facetSetupDocumentId)
return NewAggregationDocumentQuery(q)
}
//TBD 4.1 IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.Highlight(string fieldName, int fragmentLength, int fragmentCount, string fragmentsField)
//TBD 4.1 IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.Highlight(string fieldName, int fragmentLength, int fragmentCount, out FieldHighlightings highlightings)
//TBD 4.1 IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.Highlight(string fieldName,string fieldKeyName, int fragmentLength,int fragmentCount,out FieldHighlightings highlightings)
//TBD 4.1 IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.Highlight<TValue>(Expression<Func<T, TValue>> propertySelector, int fragmentLength, int fragmentCount, Expression<Func<T, IEnumerable>> fragmentsPropertySelector)
//TBD 4.1 IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.Highlight<TValue>(Expression<Func<T, TValue>> propertySelector, int fragmentLength, int fragmentCount, out FieldHighlightings fieldHighlightings)
//TBD 4.1 IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.Highlight<TValue>(Expression<Func<T, TValue>> propertySelector, Expression<Func<T, TValue>> keyPropertySelector, int fragmentLength, int fragmentCount, out FieldHighlightings fieldHighlightings)
//TBD 4.1 IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.SetHighlighterTags(string preTag, string postTag)
//TBD 4.1 IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.SetHighlighterTags(string[] preTags, string[] postTags)
//TBD expr IDocumentQuery<T> Spatial(Expression<Func<T, object>> path, Func<SpatialCriteriaFactory, SpatialCriteria> clause)
func (q *DocumentQuery) Spatial3(fieldName string, clause func(*SpatialCriteriaFactory) SpatialCriteria) *IDocumentQuery {
criteria := clause(SpatialCriteriaFactory_INSTANCE)
q._spatial3(fieldName, criteria)
return q
}
func (q *DocumentQuery) Spatial2(field DynamicSpatialField, clause func(*SpatialCriteriaFactory) SpatialCriteria) *IDocumentQuery {
criteria := clause(SpatialCriteriaFactory_INSTANCE)
q._spatial2(field, criteria)
return q
}
//TBD expr IDocumentQuery<T> Spatial(Func<SpatialDynamicFieldFactory<T>, DynamicSpatialField> field, Func<SpatialCriteriaFactory, SpatialCriteria> clause)
//TBD expr IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.WithinRadiusOf<TValue>(Expression<Func<T, TValue>> propertySelector, float64 radius, float64 latitude, float64 longitude, SpatialUnits? radiusUnits, float64 distanceErrorPct)
func (q *DocumentQuery) WithinRadiusOf(fieldName string, radius float64, latitude float64, longitude float64) *IDocumentQuery {
q._withinRadiusOf(fieldName, radius, latitude, longitude, "", Constants_Documents_Indexing_Spatial_DEFAULT_DISTANCE_ERROR_PCT)
return q
}
func (q *DocumentQuery) WithinRadiusOfWithUnits(fieldName string, radius float64, latitude float64, longitude float64, radiusUnits SpatialUnits) *IDocumentQuery {
q._withinRadiusOf(fieldName, radius, latitude, longitude, radiusUnits, Constants_Documents_Indexing_Spatial_DEFAULT_DISTANCE_ERROR_PCT)
return q
}
func (q *DocumentQuery) WithinRadiusOfWithUnitsAndError(fieldName string, radius float64, latitude float64, longitude float64, radiusUnits SpatialUnits, distanceErrorPct float64) *IDocumentQuery {
q._withinRadiusOf(fieldName, radius, latitude, longitude, radiusUnits, distanceErrorPct)
return q
}
//TBD expr IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.RelatesToShape<TValue>(Expression<Func<T, TValue>> propertySelector, string shapeWkt, SpatialRelation relation, float64 distanceErrorPct)
func (q *DocumentQuery) RelatesToShape(fieldName string, shapeWkt string, relation SpatialRelation) *IDocumentQuery {
return q.RelatesToShapeWithError(fieldName, shapeWkt, relation, Constants_Documents_Indexing_Spatial_DEFAULT_DISTANCE_ERROR_PCT)
}
func (q *DocumentQuery) RelatesToShapeWithError(fieldName string, shapeWkt string, relation SpatialRelation, distanceErrorPct float64) *IDocumentQuery {
q._spatial(fieldName, shapeWkt, relation, distanceErrorPct)
return q
}
func (q *DocumentQuery) OrderByDistance(field DynamicSpatialField, latitude float64, longitude float64) *IDocumentQuery {
q._orderByDistance(field, latitude, longitude)
return q
}
//TBD expr IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.OrderByDistance(Func<DynamicSpatialFieldFactory<T>, DynamicSpatialField> field, float64 latitude, float64 longitude)
func (q *DocumentQuery) OrderByDistance2(field DynamicSpatialField, shapeWkt string) *IDocumentQuery {
q._orderByDistance2(field, shapeWkt)
return q
}
//TBD expr IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.OrderByDistance(Func<DynamicSpatialFieldFactory<T>, DynamicSpatialField> field, string shapeWkt)
//TBD expr IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.OrderByDistance<TValue>(Expression<Func<T, TValue>> propertySelector, float64 latitude, float64 longitude)
func (q *DocumentQuery) OrderByDistanceLatLong(fieldName string, latitude float64, longitude float64) *IDocumentQuery {
q._orderByDistanceLatLong(fieldName, latitude, longitude)
return q
}
//TBD expr IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.OrderByDistance<TValue>(Expression<Func<T, TValue>> propertySelector, string shapeWkt)
func (q *DocumentQuery) OrderByDistance3(fieldName string, shapeWkt string) *IDocumentQuery {
q._orderByDistance3(fieldName, shapeWkt)
return q
}
func (q *DocumentQuery) OrderByDistanceDescending(field DynamicSpatialField, latitude float64, longitude float64) *IDocumentQuery {
q._orderByDistanceDescending(field, latitude, longitude)
return q
}
//TBD expr IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.OrderByDistanceDescending(Func<DynamicSpatialFieldFactory<T>, DynamicSpatialField> field, float64 latitude, float64 longitude)
func (q *DocumentQuery) OrderByDistanceDescending2(field DynamicSpatialField, shapeWkt string) *IDocumentQuery {
q._orderByDistanceDescending2(field, shapeWkt)
return q
}
//TBD expr IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.OrderByDistanceDescending(Func<DynamicSpatialFieldFactory<T>, DynamicSpatialField> field, string shapeWkt)
//TBD expr IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.OrderByDistanceDescending<TValue>(Expression<Func<T, TValue>> propertySelector, float64 latitude, float64 longitude)
func (q *DocumentQuery) OrderByDistanceDescendingLatLong(fieldName string, latitude float64, longitude float64) *IDocumentQuery {
q._orderByDistanceDescendingLatLong(fieldName, latitude, longitude)
return q
}
//TBD expr IDocumentQuery<T> IDocumentQueryBase<T, IDocumentQuery<T>>.OrderByDistanceDescending<TValue>(Expression<Func<T, TValue>> propertySelector, string shapeWkt)
func (q *DocumentQuery) OrderByDistanceDescending3(fieldName string, shapeWkt string) *IDocumentQuery {
q._orderByDistanceDescending3(fieldName, shapeWkt)
return q
}
func (q *DocumentQuery) MoreLikeThis(moreLikeThis MoreLikeThisBase) *DocumentQuery {
mlt := q._moreLikeThis()
defer mlt.Close()
mlt.WithOptions(moreLikeThis.GetOptions())
if mltud, ok := moreLikeThis.(*MoreLikeThisUsingDocument); ok {
mlt.withDocument(mltud.getDocumentJson())
}
return q
}
func (q *DocumentQuery) MoreLikeThisWithBuilder(builder func(IMoreLikeThisBuilderForDocumentQuery)) *DocumentQuery {
f := NewMoreLikeThisBuilder()
builder(f)
moreLikeThis := q._moreLikeThis()
moreLikeThis.WithOptions(f.GetMoreLikeThis().GetOptions())
tmp := f.GetMoreLikeThis()
if mlt, ok := tmp.(*MoreLikeThisUsingDocument); ok {
moreLikeThis.withDocument(mlt.getDocumentJson())
} else if mlt, ok := tmp.(*MoreLikeThisUsingDocumentForDocumentQuery); ok {
mlt.GetForDocumentQuery()(q)
}
moreLikeThis.Close()
return q
}
func (q *DocumentQuery) SuggestUsing(suggestion SuggestionBase) *ISuggestionDocumentQuery {
q._suggestUsing(suggestion)
return NewSuggestionDocumentQuery(q)
}
func (q *DocumentQuery) SuggestUsingBuilder(builder func(ISuggestionBuilder)) *ISuggestionDocumentQuery {
f := NewSuggestionBuilder()
builder(f)
q.SuggestUsing(f.getSuggestion())
return NewSuggestionDocumentQuery(q)
}