github.com/weaviate/weaviate@v1.24.6/usecases/traverser/explorer_validate_scroll.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  package traverser
    13  
    14  import (
    15  	"fmt"
    16  
    17  	"github.com/weaviate/weaviate/entities/dto"
    18  	"github.com/weaviate/weaviate/entities/filters"
    19  	"github.com/weaviate/weaviate/entities/schema"
    20  )
    21  
    22  func (e *Explorer) validateCursor(params dto.GetParams) error {
    23  	if params.Cursor != nil {
    24  		if params.Group != nil || params.HybridSearch != nil || params.KeywordRanking != nil ||
    25  			params.NearObject != nil || params.NearVector != nil || len(params.ModuleParams) > 0 {
    26  			return fmt.Errorf("other params cannot be set with after and limit parameters")
    27  		}
    28  		if err := filters.ValidateCursor(schema.ClassName(params.ClassName),
    29  			params.Cursor, params.Pagination.Offset, params.Filters, params.Sort); err != nil {
    30  			return err
    31  		}
    32  	}
    33  	return nil
    34  }