@@ -379,32 +379,37 @@ type CreateIndexRequest struct {
379
379
//
380
380
// Documentation: https://www.meilisearch.com/docs/reference/api/search#search-parameters
381
381
type SearchRequest struct {
382
- Offset int64 `json:"offset,omitempty"`
383
- Limit int64 `json:"limit,omitempty"`
384
- AttributesToRetrieve []string `json:"attributesToRetrieve,omitempty"`
385
- AttributesToSearchOn []string `json:"attributesToSearchOn,omitempty"`
386
- AttributesToCrop []string `json:"attributesToCrop,omitempty"`
387
- CropLength int64 `json:"cropLength,omitempty"`
388
- CropMarker string `json:"cropMarker,omitempty"`
389
- AttributesToHighlight []string `json:"attributesToHighlight,omitempty"`
390
- HighlightPreTag string `json:"highlightPreTag,omitempty"`
391
- HighlightPostTag string `json:"highlightPostTag,omitempty"`
392
- MatchingStrategy MatchingStrategy `json:"matchingStrategy,omitempty"`
393
- Filter interface {} `json:"filter,omitempty"`
394
- ShowMatchesPosition bool `json:"showMatchesPosition,omitempty"`
395
- ShowRankingScore bool `json:"showRankingScore,omitempty"`
396
- ShowRankingScoreDetails bool `json:"showRankingScoreDetails,omitempty"`
397
- Facets []string `json:"facets,omitempty"`
398
- Sort []string `json:"sort,omitempty"`
399
- Vector []float32 `json:"vector,omitempty"`
400
- HitsPerPage int64 `json:"hitsPerPage,omitempty"`
401
- Page int64 `json:"page,omitempty"`
402
- IndexUID string `json:"indexUid,omitempty"`
403
- Query string `json:"q"`
404
- Distinct string `json:"distinct,omitempty"`
405
- Hybrid * SearchRequestHybrid `json:"hybrid,omitempty"`
406
- RetrieveVectors bool `json:"retrieveVectors,omitempty"`
407
- RankingScoreThreshold float64 `json:"rankingScoreThreshold,omitempty"`
382
+ Offset int64 `json:"offset,omitempty"`
383
+ Limit int64 `json:"limit,omitempty"`
384
+ AttributesToRetrieve []string `json:"attributesToRetrieve,omitempty"`
385
+ AttributesToSearchOn []string `json:"attributesToSearchOn,omitempty"`
386
+ AttributesToCrop []string `json:"attributesToCrop,omitempty"`
387
+ CropLength int64 `json:"cropLength,omitempty"`
388
+ CropMarker string `json:"cropMarker,omitempty"`
389
+ AttributesToHighlight []string `json:"attributesToHighlight,omitempty"`
390
+ HighlightPreTag string `json:"highlightPreTag,omitempty"`
391
+ HighlightPostTag string `json:"highlightPostTag,omitempty"`
392
+ MatchingStrategy MatchingStrategy `json:"matchingStrategy,omitempty"`
393
+ Filter interface {} `json:"filter,omitempty"`
394
+ ShowMatchesPosition bool `json:"showMatchesPosition,omitempty"`
395
+ ShowRankingScore bool `json:"showRankingScore,omitempty"`
396
+ ShowRankingScoreDetails bool `json:"showRankingScoreDetails,omitempty"`
397
+ Facets []string `json:"facets,omitempty"`
398
+ Sort []string `json:"sort,omitempty"`
399
+ Vector []float32 `json:"vector,omitempty"`
400
+ HitsPerPage int64 `json:"hitsPerPage,omitempty"`
401
+ Page int64 `json:"page,omitempty"`
402
+ IndexUID string `json:"indexUid,omitempty"`
403
+ Query string `json:"q"`
404
+ Distinct string `json:"distinct,omitempty"`
405
+ Hybrid * SearchRequestHybrid `json:"hybrid,omitempty"`
406
+ RetrieveVectors bool `json:"retrieveVectors,omitempty"`
407
+ RankingScoreThreshold float64 `json:"rankingScoreThreshold,omitempty"`
408
+ FederationOptions * SearchFederationOptions `json:"federationOptions,omitempty"`
409
+ }
410
+
411
+ type SearchFederationOptions struct {
412
+ Weight float64 `json:"weight"`
408
413
}
409
414
410
415
type SearchRequestHybrid struct {
@@ -413,7 +418,13 @@ type SearchRequestHybrid struct {
413
418
}
414
419
415
420
type MultiSearchRequest struct {
416
- Queries []* SearchRequest `json:"queries"`
421
+ Federation * MultiSearchFederation `json:"federation,omitempty"`
422
+ Queries []* SearchRequest `json:"queries"`
423
+ }
424
+
425
+ type MultiSearchFederation struct {
426
+ Offset int64 `json:"offset,omitempty"`
427
+ Limit int64 `json:"limit,omitempty"`
417
428
}
418
429
419
430
// SearchResponse is the response body for search method
@@ -434,7 +445,13 @@ type SearchResponse struct {
434
445
}
435
446
436
447
type MultiSearchResponse struct {
437
- Results []SearchResponse `json:"results"`
448
+ Results []SearchResponse `json:"results,omitempty"`
449
+ Hits []interface {} `json:"hits,omitempty"`
450
+ ProcessingTimeMs int64 `json:"processingTimeMs,omitempty"`
451
+ Offset int64 `json:"offset,omitempty"`
452
+ Limit int64 `json:"limit,omitempty"`
453
+ EstimatedTotalHits int64 `json:"estimatedTotalHits,omitempty"`
454
+ SemanticHitCount int64 `json:"semanticHitCount,omitempty"`
438
455
}
439
456
440
457
type FacetSearchRequest struct {
@@ -532,9 +549,6 @@ func (b RawType) MarshalJSON() ([]byte, error) {
532
549
}
533
550
534
551
func (s * SearchRequest ) validate () {
535
- if s .Limit == 0 {
536
- s .Limit = DefaultLimit
537
- }
538
552
if s .Hybrid != nil && s .Hybrid .Embedder == "" {
539
553
s .Hybrid .Embedder = "default"
540
554
}
0 commit comments