WeaviateEx.Property.Nested (WeaviateEx v0.7.4)
View SourceNested property definition for object and object_array data types.
Provides a typed struct for defining nested properties within object-type properties. Supports recursive nesting for complex data structures.
Examples
# Simple nested property
Nested.new(name: "author", data_type: :text)
# Nested object with sub-properties
Nested.new(
name: "metadata",
data_type: :object,
nested_properties: [
Nested.new(name: "author", data_type: :text),
Nested.new(name: "tags", data_type: :text_array)
]
)
# Deeply nested structure
Nested.new(
name: "metadata",
data_type: :object,
nested_properties: [
Nested.new(
name: "stats",
data_type: :object,
nested_properties: [
Nested.new(name: "views", data_type: :int),
Nested.new(name: "likes", data_type: :int)
]
)
]
)
Summary
Functions
Parses a Weaviate API response into a Nested struct.
Creates a new nested property definition.
Checks if the nested property is an object type.
Converts a Nested struct to Weaviate API format.
Validates a Nested struct.
Types
Functions
Parses a Weaviate API response into a Nested struct.
Examples
api = %{"name" => "title", "dataType" => ["text"]}
Nested.from_api(api)
# => %Nested{name: "title", data_type: :text}
Creates a new nested property definition.
Required Options
:name- Property name (required):data_type- Data type atom (required)
Optional Options
:nested_properties- List of child Nested structs (for object types):description- Property description:indexable- Whether property is filterable/searchable:tokenization- Tokenization strategy (:word, :whitespace, :field, etc.)
Examples
Nested.new(name: "title", data_type: :text)
Nested.new(name: "metadata", data_type: :object, nested_properties: [...])
Checks if the nested property is an object type.
Examples
Nested.object_type?(%Nested{data_type: :object})
# => true
Nested.object_type?(%Nested{data_type: :text})
# => false
Converts a Nested struct to Weaviate API format.
Examples
nested = Nested.new(name: "title", data_type: :text)
Nested.to_api(nested)
# => %{"name" => "title", "dataType" => ["text"]}
Validates a Nested struct.
Returns true if:
- Object types have nested_properties defined
- Non-object types do NOT have nested_properties
Examples
nested = Nested.new(name: "title", data_type: :text)
Nested.valid?(nested)
# => true
nested = Nested.new(name: "data", data_type: :object)
Nested.valid?(nested)
# => false (object must have nested_properties)