github.com/weaviate/weaviate@v1.24.6/entities/inverted/errors.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 inverted 13 14 import "fmt" 15 16 type MissingIndexError struct { 17 format string 18 args []any 19 } 20 21 func NewMissingFilterableIndexError(propName string) error { 22 return MissingIndexError{missingFilterableFormat, []any{propName, propName}} 23 } 24 25 func NewMissingSearchableIndexError(propName string) error { 26 return MissingIndexError{missingSearchableFormat, []any{propName, propName}} 27 } 28 29 func NewMissingFilterableMetaCountIndexError(propName string) error { 30 return MissingIndexError{missingFilterableMetaCountFormat, []any{propName, propName}} 31 } 32 33 func (e MissingIndexError) Error() string { 34 return fmt.Sprintf(e.format, e.args...) 35 } 36 37 const ( 38 missingFilterableFormat = "Filtering by property '%s' requires inverted index. " + 39 "Is `indexFilterable` option of property '%s' enabled? " + 40 "Set it to `true` or leave empty" 41 missingSearchableFormat = "Searching by property '%s' requires inverted index. " + 42 "Is `indexSearchable` option of property '%s' enabled? " + 43 "Set it to `true` or leave empty" 44 missingFilterableMetaCountFormat = "Searching by property '%s' count requires inverted index. " + 45 "Is `indexFilterable` option of property '%s' enabled? " + 46 "Set it to `true` or leave empty" 47 )