Documentation
¶
Index ¶
- Constants
- Variables
- func ActivityStatus(status string) string
- func AutoTenantActivationEnabled(class *models.Class) bool
- func AutoTenantCreationEnabled(class *models.Class) bool
- func CollectionToClass(c Collection) models.Class
- func DedupProperties(oldProps, newProps []*models.Property) []*models.Property
- func DiffRecursivelyNestedProperties(nestPropsOld, nestPropsNew []*models.NestedProperty) []*models.NestedProperty
- func GetClassByName(s *models.Schema, className string) (*models.Class, error)
- func GetNestedPropertyByName[P PropertyInterface](p P, propName string) (*models.NestedProperty, error)
- func GetPropertyByName(c *models.Class, propName string) (*models.Property, error)
- func GetPropertyNamesFromClass(class *models.Class, includeRef bool) []string
- func HashBlob(base64Data string) string
- func HashBlobHashPrimitiveProperties(class *models.Class, props map[string]interface{})
- func HashBlobHashProperties(class *models.Class, obj *models.Object)
- func InvertedIndexConfigToModel(i InvertedIndexConfig) models.InvertedIndexConfig
- func IsArrayDataType(dt []string) bool
- func IsBlobDataType(dt []string) bool
- func IsBlobHashDataType(dt []string) bool
- func IsBlobLikeDataType(dt []string) bool
- func IsLikelySHA256Hash(s string) bool
- func IsNested(dataType DataType) bool
- func IsNestedFilterable(np *models.NestedProperty) bool
- func IsNestedRangeable(np *models.NestedProperty, dt DataType) bool
- func IsNestedSearchable(np *models.NestedProperty, dt DataType) bool
- func IsPropertyLength(propName string, offset int) (string, bool)
- func IsRefDataType(dt []string) bool
- func IsScalarArrayType(dt DataType) bool
- func IsValidTokenization(t string) bool
- func IsValidValueDataType(dt string) bool
- func LowercaseAllPropertyNames(props []*models.Property) []*models.Property
- func LowercaseFirstLetter(name string) string
- func LowercaseFirstLetterOfStrings(in []string) []string
- func MergeRecursivelyNestedProperties(nestPropsOld, nestPropsNew []*models.NestedProperty) ([]*models.NestedProperty, bool)
- func MultiTenancyEnabled(class *models.Class) bool
- func NestedPropertyToModel(n NestedProperty) models.NestedProperty
- func PropertyToModel(p Property) models.Property
- func ShardingConfigToModel(s ShardingConfig) interface{}
- func UppercaseClassName(name string) string
- func UppercaseClassesNames(names ...string) []string
- func ValidateAliasName(name string) (string, error)
- func ValidateNamespaceNameSyntax(name string) error
- func ValidateNestedPropertyName(name, prefix string) error
- func ValidateReservedPropertyName(name string) error
- func ValidateReservedPropertyNameSuffix(name string) error
- func ValidateTenantName(name string) error
- func ValidateTenantNameIncludesRegex(name string) error
- type BM25Config
- type ClassAndProperty
- type ClassName
- type Collection
- type DataType
- func AsNested(dataType []string) (DataType, bool)
- func AsPrimitive(dataType []string) (DataType, bool)
- func GetNestedPropertyDataType[P PropertyInterface](p P, propertyName string) (*DataType, error)
- func GetPropertyDataType(class *models.Class, propertyName string) (*DataType, error)
- func GetValueDataTypeFromString(dt string) (*DataType, error)
- func IsArrayType(dt DataType) (DataType, bool)
- func ScalarFromArrayType(dt DataType) DataType
- type InvertedIndexConfig
- type MultiTenancyConfig
- type NestedProperty
- type Property
- type PropertyDataType
- type PropertyInterface
- type PropertyKind
- type PropertyName
- type ReplicationConfig
- type Schema
- func (s *Schema) FindClassByName(className ClassName) *models.Class
- func (s *Schema) FindPropertyDataType(dataType []string) (PropertyDataType, error)
- func (s *Schema) GetClass(className string) *models.Class
- func (s *Schema) GetProperty(className ClassName, propName PropertyName) (*models.Property, error)
- func (s *Schema) GetPropsOfType(propType string) []ClassAndProperty
- func (s *Schema) SemanticSchemaFor() *models.Schema
- type SchemaWithAliases
- type ShardingConfig
- type TextAnalyzer
- type VectorIndexType
Constants ¶
const ( ErrorNoSuchClass string = "no such class with name '%s' found in the schema. Check your schema files for which classes are available" ErrorNoSuchProperty string = "" /* 135-byte string literal not displayed */ ErrorNoSuchDatatype string = "given value-DataType does not exist" )
const ( NestedIndexFilterableDefault = true NestedIndexSearchableDefault = true NestedIndexRangeableDefault = false )
Default values applied when a NestedProperty's index setting is unset (the pointer field is nil). Each index type has its own default:
- filterable defaults to true (matches flat-property behaviour: a property is filterable unless explicitly disabled).
- searchable defaults to true (matches flat-property behaviour for text types; ignored for non-text types).
- rangeable defaults to false (opt-in for numeric/date types to avoid creating the rangeable bucket unless requested).
const ( InternalPropertyLengthSuffix = "_propertyLength" InternalNullStateSuffix = "_nullState" InternalSearchableSuffix = "_searchable" InternalRangeableSuffix = "_rangeable" InternalTempSuffix = "_temp" InternalMetaCountSuffix = "__meta_count" )
Canonical suffixes appended to property names to form internal bucket or directory names for inverted and auxiliary indices. Also re-exported from entities/filters (InternalPropertyLength, InternalNullIndex) for API stability.
const ( // ClassNameMaxLength is restricted by the max length allowed for a // directory name (255 chars). As the dir containing class data is named // after the class, 255 chars are allowed. ClassNameMaxLength = 255 ClassNameRegexCore = `[A-Z][_0-9A-Za-z]{0,254}` // ClassNameRegexAllowRegex allowed chars in class name including regex patterns, 255 chars are allowed ClassNameRegexAllowRegex = `^(\*|[A-Z][_0-9A-Za-z\-.*+?^$()|{}\[\]\\]{0,254})$` // ShardNameRegexCore allowed chars in shard name, 64 chars are allowed ShardNameRegexCore = `[A-Za-z0-9\-\_]{1,64}` // ShardNameRegexAllowRegex allowed chars in shard name including regex patterns, 64 chars are allowed ShardNameRegexAllowRegex = `^[A-Za-z0-9\-_.*+?^$()|{}\[\]\\*]{1,64}$` PropertyNameRegex = `[_A-Za-z][_0-9A-Za-z]{0,230}` // Nested properties names are not used to build directory names (yet), // no max length restriction is imposed NestedPropertyNameRegex = `[_A-Za-z][_0-9A-Za-z]*` // Target vector names must be GraphQL compliant names no longer then 230 characters TargetVectorNameMaxLength = 230 TargetVectorNameRegex = `[_A-Za-z][_0-9A-Za-z]{0,229}` // NamespaceSeparator is the reserved character used to qualify class names // with their owning namespace ("<namespace>:<ClassName>"). Plain class names // must NOT contain this character — the ClassNameRegexCore character class // [_0-9A-Za-z] excludes it, so any name passing ValidateClassName cannot // contain one. // // The namespace startup invariant and the name resolver both depend on // this contract. If ClassNameRegexCore is ever loosened to allow ":", // audit all consumers of NamespaceSeparator and update them atomically. // TestValidateClassName_RejectsNamespaceSeparator locks the contract. NamespaceSeparator = ":" // Namespace name validation contract (kept tight so the operator API gives // predictable results and so name-in-URL round-tripping is unambiguous): // // - Contains only lowercase ASCII letters, digits, and hyphens. // - Must start and end with a lowercase letter or digit (no leading or // trailing hyphens). // - Length in [NamespaceMinLength, NamespaceMaxLength]. // - Must not collide with a reserved name. // // The regex and reserved-name list live in usecases/namespaces alongside // ValidateName; only the length bounds are shared here so both the // namespace controller and the syntactic qualification helpers // (usecases/schema/namespacing) read from a single source of truth. // Reserved names are held back for platform/system use (e.g. a future // "default" namespace or routing sentinels) and are refused at Create time. NamespaceMinLength = 3 NamespaceMaxLength = 36 )
Variables ¶
var ( // NamespaceNameRegexCore is the single source of truth for the namespace // name character set + length contract: lowercase letter/digit edges, // hyphens only internally, total length in [NamespaceMinLength, // NamespaceMaxLength]. The {N,M} middle bound subtracts 2 to account for // the required leading and trailing [a-z0-9] characters. // // Used both by the anchored validateNamespaceNameRegex (callers that // receive a bare namespace name) and by IndexNameRegexCore (the // cluster-API URL router, which needs the same syntax embedded in a // larger pattern). Do not duplicate this regex elsewhere — extend or // reuse this constant so the contract stays in one place. NamespaceNameRegexCore = fmt.Sprintf(`[a-z0-9][a-z0-9-]{%d,%d}[a-z0-9]`, NamespaceMinLength-2, NamespaceMaxLength-2) // IndexNameRegexCore matches an internal index name: an optional // "<namespace>:" prefix followed by a ClassNameRegexCore class name. // // Used by cluster-API URL routing and by ValidateQualifiedClassName // at post-resolver boundaries (filter parser). User-facing class-name // validation continues to use ClassNameRegexCore (which rejects ":"). IndexNameRegexCore = `(?:` + NamespaceNameRegexCore + NamespaceSeparator + `)?` + ClassNameRegexCore )
var AllTokenizations = []string{ models.PropertyTokenizationWord, models.PropertyTokenizationLowercase, models.PropertyTokenizationWhitespace, models.PropertyTokenizationField, models.PropertyTokenizationTrigram, models.PropertyTokenizationGse, models.PropertyTokenizationKagomeKr, models.PropertyTokenizationKagomeJa, models.PropertyTokenizationGseCh, }
AllTokenizations is the canonical list of tokenization names that Weaviate recognises for text / text[] properties. This is the union of every value the schema layer accepts; whether a given tokenizer is actually usable at runtime can additionally depend on env-gating (ENABLE_TOKENIZER_*), which is enforced separately by the schema validator and the tokenizer package.
This list MUST stay in sync with the switch in (*Handler).validatePropertyTokenization (usecases/schema/class.go). Use IsValidTokenization for membership checks instead of duplicating the list at call sites.
var DeprecatedPrimitiveDataTypes []DataType = []DataType{ DataTypeString, DataTypeStringArray, }
var ErrRefToNonexistentClass = errors.New("reference property to nonexistent class")
var NestedDataTypes []DataType = []DataType{ DataTypeObject, DataTypeObjectArray, }
var PrimitiveDataTypes []DataType = []DataType{ DataTypeText, DataTypeInt, DataTypeNumber, DataTypeBoolean, DataTypeDate, DataTypeGeoCoordinates, DataTypePhoneNumber, DataTypeBlob, DataTypeBlobHash, DataTypeTextArray, DataTypeIntArray, DataTypeNumberArray, DataTypeBooleanArray, DataTypeDateArray, DataTypeUUID, DataTypeUUIDArray, }
Functions ¶
func ActivityStatus ¶ added in v1.21.0
func AutoTenantActivationEnabled ¶ added in v1.25.2
func AutoTenantCreationEnabled ¶ added in v1.25.0
func CollectionToClass ¶ added in v1.25.0
func CollectionToClass(c Collection) models.Class
CollectionToClass returns a models.Class from c. If the original models.Class from which c was created had nil pointers they will be replaced with default initialized structs in models.Class.
func DedupProperties ¶ added in v1.25.0
DedupProperties removes from newProps slice properties already present in oldProps slice. If property of nested type (object/object[]) is present in both slices, diff is calculated to contain only those nested properties that are missing from old property model
func DiffRecursivelyNestedProperties ¶ added in v1.25.0
func DiffRecursivelyNestedProperties(nestPropsOld, nestPropsNew []*models.NestedProperty, ) []*models.NestedProperty
Determines diff between nestPropsNew and nestPropsOld slices
func GetClassByName ¶
GetClassByName returns the class by its name.
func GetNestedPropertyByName ¶ added in v1.22.0
func GetNestedPropertyByName[P PropertyInterface](p P, propName string) (*models.NestedProperty, error)
func GetPropertyByName ¶
GetPropertyByName returns a frst-order property by its name. If propName is a name of the nested property, then this property is returned. It is not possible to retrieve deeply nested properties using the dot-notation.
func GetPropertyNamesFromClass ¶ added in v1.27.0
func HashBlob ¶ added in v1.37.0
HashBlob computes a SHA-256 hash of the given base64-encoded blob string and returns the hex-encoded digest. This is used by the BlobHash data type to store a compact hash instead of the full blob payload.
func HashBlobHashPrimitiveProperties ¶ added in v1.37.0
HashBlobHashPrimitiveProperties replaces the base64 data of all BlobHash properties in the given property map with their SHA-256 hashes. This variant operates on a raw property map and is used by the merge/patch path where properties have already been split from references.
func HashBlobHashProperties ¶ added in v1.37.0
HashBlobHashProperties replaces the base64 data of all BlobHash properties on the object with their SHA-256 hashes. This must be called AFTER vectorization (so vectorizers see the raw media data) but BEFORE storage (so only the compact hash is persisted to disk).
func InvertedIndexConfigToModel ¶ added in v1.25.0
func InvertedIndexConfigToModel(i InvertedIndexConfig) models.InvertedIndexConfig
func IsArrayDataType ¶
func IsBlobDataType ¶
func IsBlobHashDataType ¶ added in v1.37.0
func IsBlobLikeDataType ¶ added in v1.37.0
IsBlobLikeDataType returns true for both blob and blobHash data types.
func IsLikelySHA256Hash ¶ added in v1.37.0
func IsNestedFilterable ¶ added in v1.38.0
func IsNestedFilterable(np *models.NestedProperty) bool
IsNestedFilterable reports whether the filterable index is enabled on the given nested property. Returns NestedIndexFilterableDefault when IndexFilterable is unset.
func IsNestedRangeable ¶ added in v1.38.0
func IsNestedRangeable(np *models.NestedProperty, dt DataType) bool
IsNestedRangeable reports whether the rangeable index is enabled on the given nested property for the given data type. The rangeable index is only meaningful for int/number/date types (and their array variants); for all other types the result is false regardless of the flag. Returns NestedIndexRangeableDefault when IndexRangeFilters is unset on a supported type.
func IsNestedSearchable ¶ added in v1.38.0
func IsNestedSearchable(np *models.NestedProperty, dt DataType) bool
IsNestedSearchable reports whether the searchable index is enabled on the given nested property for the given data type. The searchable index is only meaningful for text and text-array types; for all other types the result is false regardless of the flag. Returns NestedIndexSearchableDefault when IndexSearchable is unset on a text type.
func IsPropertyLength ¶
IsPropertyLength returns if a string is a filters for property length. They have the form len(*PROPNAME*)
func IsRefDataType ¶
IsRefDataType reports whether dt is a cross-reference DataType. Expects stored DataType — qualified "<namespace>:Class" or bare "Class". User-supplied DataType must go through FindPropertyDataTypeWithRefsAndAuth.
func IsScalarArrayType ¶ added in v1.38.0
func IsValidTokenization ¶ added in v1.38.0
IsValidTokenization reports whether t is one of the canonical tokenization values defined in AllTokenizations. It performs a pure name-based check and does NOT consider env-gating (e.g. whether the gse_ch tokenizer is enabled at runtime). Use this for input validation; rely on the schema validator for full semantic checks.
func IsValidValueDataType ¶
IsValidValueDataType checks whether the given string is a valid data type
func LowercaseAllPropertyNames ¶ added in v1.18.2
func LowercaseFirstLetter ¶ added in v1.18.2
func LowercaseFirstLetterOfStrings ¶ added in v1.21.3
func MergeRecursivelyNestedProperties ¶ added in v1.22.0
func MergeRecursivelyNestedProperties(nestPropsOld, nestPropsNew []*models.NestedProperty, ) ([]*models.NestedProperty, bool)
Merges nestPropsNew with nestPropsOld Returns new slice without changing input ones and bool indicating whether merged slice is different than the old one
func MultiTenancyEnabled ¶ added in v1.20.0
func NestedPropertyToModel ¶ added in v1.25.0
func NestedPropertyToModel(n NestedProperty) models.NestedProperty
NestedPropertyToModel returns a models.NestedProperty from n. If the original models.NestedProperty from which n was created had nil pointers they will be replaced with default initialized structs in NestedProperty.
func PropertyToModel ¶ added in v1.25.0
PropertyToModel returns a models.Property from p. If the original models.Property from which n was created had nil pointers they will be replaced with default initialized structs in Property.
func ShardingConfigToModel ¶ added in v1.25.0
func ShardingConfigToModel(s ShardingConfig) interface{}
ShardingConfigToModel returns an interface{} containing a sharding.Config from s.
func UppercaseClassName ¶ added in v1.18.2
func UppercaseClassesNames ¶ added in v1.28.0
func ValidateAliasName ¶ added in v1.32.2
func ValidateNamespaceNameSyntax ¶ added in v1.38.0
ValidateNamespaceNameSyntax checks the syntax of a namespace name: length bounds, lowercase ASCII letters/digits/hyphens, no leading/trailing hyphen. It does NOT check reserved names — that policy lives in usecases/namespaces alongside ValidateName and is enforced at Create time. This split lets the name-resolver (usecases/schema/namespacing) reuse the syntactic part without importing the namespace controller (which would form a cycle via the apikey dependency chain).
func ValidateNestedPropertyName ¶ added in v1.22.0
ValidateNestedPropertyName validates that this string is a valid nested property name
func ValidateReservedPropertyName ¶
ValidateReservedPropertyName validates that a string is not a reserved property name
func ValidateReservedPropertyNameSuffix ¶ added in v1.35.20
ValidateReservedPropertyNameSuffix rejects property names whose suffix would collide with internal bucket/directory names derived from other properties. Only applied on creation paths — existing schemas (backup restore, startup) must continue to load even if they contain legacy names matching these suffixes.
func ValidateTenantName ¶ added in v1.28.3
ValidateTenantName validates that this string is a valid tenant name (format wise)
func ValidateTenantNameIncludesRegex ¶ added in v1.28.3
ValidateTenantNameIncludesRegex validates that this string is a valid tenant name (format wise) can include regex pattern
Types ¶
type BM25Config ¶
type ClassAndProperty ¶
type ClassAndProperty struct {
ClassName ClassName
PropertyName PropertyName
}
type ClassName ¶
type ClassName string
Newtype to denote that this string is used as a Class name
func AssertValidClassName ¶
AssertValidClassName assert that this string is a valid class name or panics and should therefore most likely not be used
func ValidateClassName ¶
ValidateClassName validates that this string is a valid class name (format wise)
func ValidateClassNameIncludesRegex ¶ added in v1.28.3
ValidateClassNameIncludesRegex validates that this string is a valid class name (format wise) can include regex pattern
func ValidateQualifiedClassName ¶ added in v1.38.0
ValidateQualifiedClassName validates that name is either a plain class name matching ClassNameRegexCore, or a namespace-qualified name "<namespace>:<Class>" where the namespace portion matches the shared namespace-name contract (lowercase ASCII letter/digit edges, hyphens only internally, length NamespaceMinLength..NamespaceMaxLength) and the class portion matches ClassNameRegexCore. The full qualified name is returned unchanged.
Use at post-resolver boundaries (e.g. the filter parser, cross-ref DataType validation) where a qualified class name is a legitimate input that has already been produced by namespacing.Resolve or namespacing.QualifyPropertyDataTypes. User-facing inputs (schema create, alias create) must continue to call ValidateClassName, which rejects ":".
type Collection ¶ added in v1.25.0
type Collection struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
// inverted index config
InvertedIndexConfig InvertedIndexConfig `json:"invertedIndex,omitempty"`
// TODO-RAFT START
// Can we also get rid of the interface{} in the value side ?
// Configuration specific to modules this Weaviate instance has installed
ModuleConfig map[string]interface{} `json:"moduleConfig,omitempty"`
// multi tenancy config
MultiTenancyConfig MultiTenancyConfig `json:"multiTenancyConfig,omitempty"`
// The properties of the class.
Properties []Property `json:"properties"`
// replication config
ReplicationConfig ReplicationConfig `json:"replicationConfig,omitempty"`
// Manage how the index should be sharded and distributed in the cluster
ShardingConfig ShardingConfig `json:"shardingConfig,omitempty"`
// VectorIndexType which vector index to use
VectorIndexType VectorIndexType `json:"vectorIndexType,omitempty"`
// VectorIndexConfig underlying implementation depends on VectorIndexType
VectorIndexConfig config.VectorIndexConfig `json:"vectorIndexConfig,omitempty"`
// Specify how the vectors for this class should be determined. The options are either 'none' - this means you have to import a vector
// with each object yourself - or the name of a module that provides vectorization capabilities, such as 'text2vec-contextionary'. If
// left empty, it will use the globally configured default which can itself either be 'none' or a specific module.
Vectorizer string `json:"vectorizer,omitempty"`
}
func CollectionFromClass ¶ added in v1.25.0
func CollectionFromClass(m models.Class) (Collection, error)
CollectionFromClass returns a Collection copied from m.
type DataType ¶
type DataType string
const ( // DataTypeCRef The data type is a cross-reference, it is starting with a capital letter DataTypeCRef DataType = "cref" // DataTypeText The data type is a value of type string DataTypeText DataType = "text" // DataTypeInt The data type is a value of type int DataTypeInt DataType = "int" // DataTypeNumber The data type is a value of type number/float DataTypeNumber DataType = "number" // DataTypeBoolean The data type is a value of type boolean DataTypeBoolean DataType = "boolean" // DataTypeDate The data type is a value of type date DataTypeDate DataType = "date" // DataTypeGeoCoordinates is used to represent geo coordinates, i.e. latitude // and longitude pairs of locations on earth DataTypeGeoCoordinates DataType = "geoCoordinates" // DataTypePhoneNumber represents a parsed/to-be-parsed phone number DataTypePhoneNumber DataType = "phoneNumber" // DataTypeBlob represents a base64 encoded data DataTypeBlob DataType = "blob" // DataTypeBlobHash accepts base64 encoded data but stores only a SHA-256 hash DataTypeBlobHash DataType = "blobHash" // DataTypeTextArray The data type is a value of type string array DataTypeTextArray DataType = "text[]" // DataTypeIntArray The data type is a value of type int array DataTypeIntArray DataType = "int[]" // DataTypeNumberArray The data type is a value of type number/float array DataTypeNumberArray DataType = "number[]" // DataTypeBooleanArray The data type is a value of type boolean array DataTypeBooleanArray DataType = "boolean[]" // DataTypeDateArray The data type is a value of type date array DataTypeDateArray DataType = "date[]" // DataTypeUUID is a native UUID data type. It is stored in it's raw byte // representation and therefore takes up less space than storing a UUID as a // string DataTypeUUID DataType = "uuid" // DataTypeUUIDArray is the array version of DataTypeUUID DataTypeUUIDArray DataType = "uuid[]" DataTypeObject DataType = "object" DataTypeObjectArray DataType = "object[]" // deprecated as of v1.19, replaced by DataTypeText + relevant tokenization setting // DataTypeString The data type is a value of type string DataTypeString DataType = "string" // deprecated as of v1.19, replaced by DataTypeTextArray + relevant tokenization setting // DataTypeArrayString The data type is a value of type string array DataTypeStringArray DataType = "string[]" )
func AsPrimitive ¶ added in v1.19.0
func GetNestedPropertyDataType ¶ added in v1.22.0
func GetNestedPropertyDataType[P PropertyInterface](p P, propertyName string) (*DataType, error)
func GetPropertyDataType ¶
GetPropertyDataType checks whether the given string is a valid data type
func GetValueDataTypeFromString ¶
GetValueDataTypeFromString checks whether the given string is a valid data type
func IsArrayType ¶
func ScalarFromArrayType ¶ added in v1.38.0
func (DataType) IsPrimitive ¶ added in v1.27.14
func (DataType) PropString ¶ added in v1.19.0
type InvertedIndexConfig ¶
type InvertedIndexConfig struct {
BM25 BM25Config
Stopwords models.StopwordConfig
StopwordPresets map[string][]string
CleanupIntervalSeconds uint64
IndexTimestamps bool
IndexNullState bool
IndexPropertyLength bool
UsingBlockMaxWAND bool
TokenizerUserDict []*models.TokenizerUserDictConfig
}
func InvertedIndexConfigFromModel ¶ added in v1.25.0
func InvertedIndexConfigFromModel(m models.InvertedIndexConfig) InvertedIndexConfig
type MultiTenancyConfig ¶ added in v1.25.0
type MultiTenancyConfig struct {
Enabled bool `json:"enabled"`
}
type NestedProperty ¶ added in v1.25.0
type NestedProperty struct {
// name
Name string `json:"name,omitempty"`
// description
Description string `json:"description,omitempty"`
// data type
DataType []string `json:"data_type"`
// index filterable
IndexFilterable bool `json:"index_filterable,omitempty"`
// index searchable
IndexSearchable bool `json:"index_searchable,omitempty"`
// index range filters
IndexRangeFilters bool `json:"index_range_filters,omitempty"`
// nested properties
NestedProperties []NestedProperty `json:"nested_properties,omitempty"`
// Text processing options for this nested property. Immutable after creation.
TextAnalyzer *TextAnalyzer `json:"text_analyzer,omitempty"`
// tokenization
// Enum: [word lowercase whitespace field]
Tokenization string `json:"tokenization,omitempty"`
}
func NestedPropertyFromModel ¶ added in v1.25.0
func NestedPropertyFromModel(m models.NestedProperty) NestedProperty
NestedPropertyFromModel returns a NestedProperty copied from m.
type Property ¶ added in v1.25.0
type Property struct {
// Name of the property as URI relative to the schema URL.
Name string `json:"name,omitempty"`
// Description of the property.
Description string `json:"description,omitempty"`
// Can be a reference to another type when it starts with a capital (for example Person), otherwise "string" or "int".
// TODO-RAFT: Can we make DataType a slice of interface where other type and native type implements it ?
DataType []string `json:"data_type"`
// Optional. Should this property be indexed in the inverted index. Defaults to true. If you choose false, you will not be able to use this property in where filters. This property has no affect on vectorization decisions done by modules
IndexFilterable bool `json:"indexFilterable,omitempty"`
// Optional. Should this property be indexed in the inverted index. Defaults to true. If you choose false, you will not be able to use this property in where filters, bm25 or hybrid search. This property has no affect on vectorization decisions done by modules (deprecated as of v1.19; use indexFilterable or/and indexSearchable instead)
IndexInverted bool `json:"indexInverted,omitempty"`
// Optional. Should this property be indexed in the inverted index. Defaults to true. Applicable only to properties of data type text and text[]. If you choose false, you will not be able to use this property in bm25 or hybrid search. This property has no affect on vectorization decisions done by modules
IndexSearchable bool `json:"indexSearchable,omitempty"`
// Optional. Should this property be indexed in the inverted index. Defaults to false. Provides better performance for range queries compared to filterable index in large datasets. Applicable only to properties of data type int, number, date."
IndexRangeFilters bool `json:"indexRangeFilters,omitempty"`
// Configuration specific to modules this Weaviate instance has installed
ModuleConfig map[string]interface{} `json:"moduleConfig,omitempty"`
// The properties of the nested object(s). Applies to object and object[] data types.
NestedProperties []NestedProperty `json:"nestedProperties,omitempty"`
// Text processing options for this property. Immutable after creation.
TextAnalyzer *TextAnalyzer `json:"textAnalyzer,omitempty"`
// Determines tokenization of the property as separate words or whole field. Optional. Applies to text and text[] data types. Allowed values are `word` (default; splits on any non-alphanumerical, lowercases), `lowercase` (splits on white spaces, lowercases), `whitespace` (splits on white spaces), `field` (trims). Not supported for remaining data types
// Enum: [word lowercase whitespace field]
Tokenization string `json:"tokenization,omitempty"`
}
func PropertyFromModel ¶ added in v1.25.0
PropertyFromModel returns a Property copied from m.
type PropertyDataType ¶
type PropertyDataType interface {
Kind() PropertyKind
IsPrimitive() bool
AsPrimitive() DataType
IsReference() bool
Classes() []ClassName
ContainsClass(name ClassName) bool
IsNested() bool
AsNested() DataType
}
func FindPropertyDataTypeWithRefs ¶ added in v1.25.0
func FindPropertyDataTypeWithRefs(authorizedGetClass func(string) *models.Class, dataType []string, relaxCrossRefValidation bool, beloningToClass ClassName) (PropertyDataType, error)
FindPropertyDataTypeWithRefs is a no auth wrapper for FindPropertyDataTypeWithRefsAndAuth
func FindPropertyDataTypeWithRefsAndAuth ¶ added in v1.28.0
func FindPropertyDataTypeWithRefsAndAuth(authorizedGetClass func(string) (*models.Class, error), dataType []string, relaxCrossRefValidation bool, beloningToClass ClassName) (PropertyDataType, error)
FindPropertyDataTypeWithRefsAndAuth Based on the schema, return a valid description of the defined datatype If relaxCrossRefValidation is set, there is no check if the referenced class exists in the schema. This can be helpful in scenarios, such as restoring from a backup where we have no guarantee over the order of class creation. If belongingToClass is set and equal to referenced class, check whether class exists in the schema is skipped. This is done to allow creating class schema with properties referencing to itself. Previously such properties had to be created separately only after creation of class schema
type PropertyInterface ¶ added in v1.22.0
type PropertyInterface interface {
GetName() string
GetNestedProperties() []*models.NestedProperty
}
type PropertyKind ¶
type PropertyKind int
const ( PropertyKindPrimitive PropertyKind = 1 PropertyKindRef PropertyKind = 2 PropertyKindNested PropertyKind = 3 )
type PropertyName ¶
type PropertyName string
Newtype to denote that this string is used as a Property name
func AssertValidPropertyName ¶
func AssertValidPropertyName(name string) PropertyName
AssertValidPropertyName asserts that this string is a valid property name or panics and should therefore most likely never be used.
func ValidatePropertyName ¶
func ValidatePropertyName(name string) (PropertyName, error)
ValidatePropertyName validates that this string is a valid property name
func (PropertyName) String ¶
func (p PropertyName) String() string
type ReplicationConfig ¶ added in v1.25.0
type ReplicationConfig struct {
// Factor represent replication factor
Factor int64 `json:"factor,omitempty"`
}
type Schema ¶
Describes the schema that is used in Weaviate.
func (*Schema) FindClassByName ¶
FindClassByName will find either a Thing or Class by name.
func (*Schema) FindPropertyDataType ¶
func (s *Schema) FindPropertyDataType(dataType []string) (PropertyDataType, error)
Based on the schema, return a valid description of the defined datatype
Note that this function will error if referenced classes do not exist. If you don't want such validation, use [Schema.FindPropertyDataTypeRelaxedRefs] instead and set relax to true
func (*Schema) GetProperty ¶
func (*Schema) GetPropsOfType ¶
func (s *Schema) GetPropsOfType(propType string) []ClassAndProperty
func (*Schema) SemanticSchemaFor ¶
Return one of the semantic schema's
type SchemaWithAliases ¶ added in v1.32.0
type ShardingConfig ¶ added in v1.25.0
type ShardingConfig struct {
VirtualPerPhysical int `json:"virtualPerPhysical"`
DesiredCount int `json:"desiredCount"`
ActualCount int `json:"actualCount"`
DesiredVirtualCount int `json:"desiredVirtualCount"`
ActualVirtualCount int `json:"actualVirtualCount"`
Key string `json:"key"`
Strategy string `json:"strategy"`
Function string `json:"function"`
}
func ShardingConfigFromModel ¶ added in v1.25.0
func ShardingConfigFromModel(m interface{}) ShardingConfig
ShardingConfigFromModel returns a ShardingConfig copied from m. If m isn't a sharding.Config underneath the interface{}, a default initialized ShardingConfig will be returned.
type TextAnalyzer ¶ added in v1.37.0
type TextAnalyzer struct {
ASCIIFold bool `json:"asciiFold,omitempty"`
ASCIIFoldIgnore []string `json:"asciiFoldIgnore,omitempty"`
StopwordPreset string `json:"stopwordPreset,omitempty"`
}
TextAnalyzer contains text processing options for a property. ASCIIFold is immutable after creation; ASCIIFoldIgnore can change, but will not be applied to already indexed data.
type VectorIndexType ¶ added in v1.25.0
type VectorIndexType int
const ( // VectorIndexTypeEmpty is used when we parse an unexpected index type VectorIndexTypeEmpty VectorIndexType = iota VectorIndexTypeHNSW VectorIndexTypeFlat VectorIndexTypeHFresh )