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 InvertedIndexConfigToModel(i InvertedIndexConfig) models.InvertedIndexConfig
- func IsArrayDataType(dt []string) bool
- func IsBlobDataType(dt []string) bool
- func IsNested(dataType DataType) bool
- func IsPropertyLength(propName string, offset int) (string, bool)
- func IsRefDataType(dt []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 ValidateNestedPropertyName(name, prefix string) error
- func ValidateReservedPropertyName(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)
- 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 ShardingConfig
- 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 ( ClassNameRegexCore = `[A-Z][_0-9A-Za-z]{0,254}` ShardNameRegexCore = `[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}` )
Variables ¶
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, 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 the class by its name
func InvertedIndexConfigToModel ¶ added in v1.25.0
func InvertedIndexConfigToModel(i InvertedIndexConfig) models.InvertedIndexConfig
func IsArrayDataType ¶
func IsBlobDataType ¶
func IsPropertyLength ¶
IsPropertyLength returns if a string is a filters for property length. They have the form len(*PROPNAME*)
func IsRefDataType ¶
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 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
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)
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" // 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 (DataType) PropString ¶ added in v1.19.0
type InvertedIndexConfig ¶
type InvertedIndexConfig struct { BM25 BM25Config Stopwords models.StopwordConfig CleanupIntervalSeconds uint64 IndexTimestamps bool IndexNullState bool IndexPropertyLength bool }
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"` // 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"` // 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(fn func(string) *models.Class, dataType []string, relaxCrossRefValidation bool, beloningToClass ClassName) (PropertyDataType, error)
FindPropertyDataTypeWithRefs 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 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 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 )