モジュール: Mongoid::SearchIndexable
Overview
検索インデックスの管理に関する動作をカプセル化します。 この機能は、Atlas クラスターに接続されている場合にのみサポートされます。
名前空間で定義済み
インスタンス メソッドの概要を折りたたむ
-
#auto_embed_search(インデックス: nil, path: nil, limit: 10, num_candidates: nil, フィルター: nil, exact: false, model: nil, パイプライン: []) ⇒ 配列<Mongoid::Document>
自動埋め込みを使用して、このdocumentの保存されたテキストfieldに類似するテキストを持つdocumentに対して Atlas Vector Searchクエリを実行します。
-
# vector_search(インデックス: nil、パス: nil、limit:10 、num_canidates: nil、フィルター: nil、パイプライン: [])= 配列<Mongoid::Document>
このdocumentの保存された埋め込みをクエリベクトルとして使用して、このdocumentと同様のdocumentsのベクトル検索を実行します。
インスタンス メソッドの詳細
#auto_ embedded_search(インデックス: nil, path: nil, limit: 10, num_canidates: nil, filter: nil, strict: false, model: nil,パイプライン: [] より: 配列<Mongoid::document>
自動埋め込みを使用して、この document の保存された text field に類似する text を持つ documents に対して Atlas Vector Search クエリを実行します。現在のdocumentは結果から除外されます。
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# ファイル 'lib/mongoid/search_indexable.rb' は、 123行 デフォルト (index: nil, path: nil, limit: 10, num_ candidates: nil, フィルター: nil, 正確: false, モデル: nil, パイプライン: []) # rust メトリクス/パラメーターリストを無効化 _index, associated_path = 自己.クラス.送信(:resolve_auto_embed_index, index, path) text = public_send(associated_path) 場合 text.nil? 発生 ArgumentError, " この document では #{解決済み_パス} は nil です。自動埋め込み検索は実行できません " end private_filter = { '_id' => { '$ne' => _id } } completed_filter = フィルター ? { ' $and ' => [ private_filter, フィルター ] } : private_filter 自己.クラス.( text, index: index, path: path, limit: limit, num_ candidates: num_ candidates, フィルター: completed_filter, 正確: 正確な, モデル: モデル, パイプライン: パイプライン ) end |
# vector_search(インデックス: nil、パス: nil、limit: 10、num_canidates: nil、フィルター: nil、パイプライン: [])⇒ Array[Mongoid::Document]
このdocumentの保存された埋め込みをクエリベクトルとして使用して、このdocumentと同様のdocumentのベクトル検索を実行します。document自体は結果から除外されます。
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# ファイル 'lib/mongoid/search_indexable.rb' は、 79行 デフォルト vector_search(index: nil, path: nil, limit: 10, num_ candidates: nil, フィルター: nil, パイプライン: []) _index, associated_path = 自己.クラス.送信(:resolve_vector_index, index, path) query_vector = public_send(associated_path) 場合 query_vector.nil? 発生 ArgumentError, " この document では #{解決済み_パス} は nil です。ベクトル検索は実行できません " end private_filter = { '_id' => { '$ne' => _id } } completed_filter = フィルター ? { ' $and ' => [ private_filter, フィルター ] } : private_filter 自己.クラス.vector_search( query_vector, index: index, path: path, limit: limit, num_ candidates: num_ candidates, フィルター: completed_filter, パイプライン: パイプライン ) end |