Module: WeaviateRecord

Defined in:
lib/weaviate_record.rb,
lib/weaviate_record/base.rb,
lib/weaviate_record/errors.rb,
lib/weaviate_record/schema.rb,
lib/weaviate_record/inspect.rb,
lib/weaviate_record/relation.rb,
lib/weaviate_record/constants.rb,
lib/weaviate_record/connection.rb,
lib/weaviate_record/queries/ask.rb,
lib/weaviate_record/queries/bm25.rb,
lib/weaviate_record/queries/count.rb,
lib/weaviate_record/queries/limit.rb,
lib/weaviate_record/queries/order.rb,
lib/weaviate_record/queries/where.rb,
lib/weaviate_record/method_missing.rb,
lib/weaviate_record/queries/offset.rb,
lib/weaviate_record/queries/select.rb,
lib/weaviate_record/queries/near_text.rb,
lib/weaviate_record/queries/near_object.rb,
lib/weaviate_record/queries/near_vector.rb,
lib/weaviate_record/relation/query_builder.rb,
lib/weaviate_record/concerns/record_concern.rb,
lib/weaviate_record/concerns/attribute_concern.rb

Overview

:nodoc: all

Defined Under Namespace

Modules: Concerns, Constants, Errors, Inspect, MethodMissing, Queries Classes: Base, Connection, Relation, Schema

Class Method Summary collapse

Class Method Details

.configObject

Configuration object for WeaviateRecord



14
15
16
17
18
19
20
# File 'lib/weaviate_record.rb', line 14

def config
  @config ||= Struct.new(
    :similarity_search_threshold,
    :schema_file_path,
    :sync_schema_on_load
  ).new(0.55, "#{Object.const_defined?('Rails') ? Rails.root : Dir.pwd}/db/weaviate/schema.rb", false)
end

.configure {|config| ... } ⇒ Object

Used to configure WeaviateRecord, accepts a block and yields the configuration object

Example:

WeaviateRecord.configure do |config|
  config.similarity_search_threshold = 0.6
  config.schema_file_path = "#{Rails.root}/db/weaviate/schema.rb"
  config.sync_schema_on_load = true
end

When sync_schema_on_load is set to true, the local schema will be synced with the database schema when WeaviateRecord is loaded.

Yields:



33
34
35
36
# File 'lib/weaviate_record.rb', line 33

def configure
  yield config if block_given?
  WeaviateRecord::Schema.update! if config.sync_schema_on_load && !WeaviateRecord::Schema.synced?
end