WeaviateEx.Property (WeaviateEx v0.7.4)

View Source

Property builder for collection schemas.

Provides a fluent API for defining collection properties with proper data types, indexing options, and nested object support.

Examples

# Simple properties
properties = [
  Property.text("title"),
  Property.text("content", tokenization: :word),
  Property.int("views"),
  Property.boolean("published"),
  Property.date("created_at")
]

# Nested object
author = Property.object("author", [
  Property.text("name"),
  Property.text("email"),
  Property.object("address", [
    Property.text("city"),
    Property.text("country")
  ])
])

# Cross-reference
ref = Property.reference("hasAuthor", "Author")

Summary

Functions

Create a blob property.

Create a boolean property

Create a boolean array property

Create a date property

Create a date array property

Create a geo coordinates property

Create an integer property

Create an integer array property

Create a multi-target cross-reference property.

Create a new property definition.

Create a number (float) property

Create a number array property

Create a nested object property.

Create a nested object array property.

Create a phone number property

Create a cross-reference property.

Create a text property

Create a text array property

Create a UUID property

Create a UUID array property

Types

opts()

@type opts() :: keyword()

t()

@type t() :: map()

Functions

blob(name, opts \\ [])

@spec blob(String.t(), opts()) :: t()

Create a blob property.

Blobs are not filterable by default.

boolean(name, opts \\ [])

@spec boolean(String.t(), opts()) :: t()

Create a boolean property

boolean_array(name, opts \\ [])

@spec boolean_array(String.t(), opts()) :: t()

Create a boolean array property

date(name, opts \\ [])

@spec date(String.t(), opts()) :: t()

Create a date property

date_array(name, opts \\ [])

@spec date_array(String.t(), opts()) :: t()

Create a date array property

geo_coordinates(name, opts \\ [])

@spec geo_coordinates(String.t(), opts()) :: t()

Create a geo coordinates property

int(name, opts \\ [])

@spec int(String.t(), opts()) :: t()

Create an integer property

int_array(name, opts \\ [])

@spec int_array(String.t(), opts()) :: t()

Create an integer array property

multi_reference(name, target_collections, opts \\ [])

@spec multi_reference(String.t(), [String.t()], opts()) :: t()

Create a multi-target cross-reference property.

Alias for reference/3 with a list of target collections.

Examples

Property.multi_reference("hasContent", ["Article", "BlogPost", "Video"])

new(name, data_type, opts \\ [])

@spec new(String.t(), atom() | String.t(), opts()) :: t()

Create a new property definition.

Options

  • :description - Property description
  • :index_filterable - Enable filtering on this property
  • :index_searchable - Enable full-text search
  • :index_inverted - Include in inverted index
  • :index_range_filters - Enable range filter indexing
  • :tokenization - Tokenization strategy (:word, :whitespace, :field, etc.)
  • :skip_vectorization - Don't include in vectorization
  • :vectorize_property_name - Include property name in vector
  • :nested_properties - For object/object[] types

Examples

Property.new("title", :text)
Property.new("title", :text, tokenization: :word, index_searchable: true)

number(name, opts \\ [])

@spec number(String.t(), opts()) :: t()

Create a number (float) property

number_array(name, opts \\ [])

@spec number_array(String.t(), opts()) :: t()

Create a number array property

object(name, nested_properties, opts \\ [])

@spec object(String.t(), [t()], opts()) :: t()

Create a nested object property.

Examples

Property.object("author", [
  Property.text("name"),
  Property.text("email"),
  Property.object("address", [
    Property.text("city"),
    Property.text("country")
  ])
])

object_array(name, nested_properties, opts \\ [])

@spec object_array(String.t(), [t()], opts()) :: t()

Create a nested object array property.

Examples

Property.object_array("authors", [
  Property.text("name"),
  Property.text("email")
])

phone_number(name, opts \\ [])

@spec phone_number(String.t(), opts()) :: t()

Create a phone number property

reference(name, target_collection, opts \\ [])

@spec reference(String.t(), String.t() | [String.t()], opts()) :: t()

Create a cross-reference property.

Supports both single-target and multi-target references.

Examples

# Single target reference
Property.reference("hasAuthor", "Author")
Property.reference("hasCategories", "Category", description: "Article categories")

# Multi-target reference (can point to any of the listed collections)
Property.reference("hasContent", ["Article", "BlogPost", "Video"])

text(name, opts \\ [])

@spec text(String.t(), opts()) :: t()

Create a text property

text_array(name, opts \\ [])

@spec text_array(String.t(), opts()) :: t()

Create a text array property

uuid(name, opts \\ [])

@spec uuid(String.t(), opts()) :: t()

Create a UUID property

uuid_array(name, opts \\ [])

@spec uuid_array(String.t(), opts()) :: t()

Create a UUID array property