Craft Vector Search 2.0
const { vectorSearch2 } = MODULES;Table of Contents
Section titled “Table of Contents”- DenseVector
- SparseVector
- VectorValue
- OutputFields
- SearchQuery
- DataObject
- SearchResult
- get
- create
- update
- delete
- query
- search
DenseVector
Section titled “DenseVector”Type: Object
Properties
Section titled “Properties”SparseVector
Section titled “SparseVector”Type: Object
Properties
Section titled “Properties”VectorValue
Section titled “VectorValue”Type: Object
Properties
Section titled “Properties”denseDenseVector? 密ベクトルsparseSparseVector? 疎ベクトル
OutputFields
Section titled “OutputFields”Type: Object
Properties
Section titled “Properties”dataFields(string | Array<string>)? 出力するデータフィールドvectorFields(string | Array<string>)? 出力するベクターフィールドmetadataFields(string | Array<string>)? 出力するメタデータフィールド
SearchQuery
Section titled “SearchQuery”Type: Object
Properties
Section titled “Properties”vectorFieldstring? 検索対象のベクターフィールド名(ベクター検索・セマンティック検索時は必須)vectorArray<number>? クエリベクトル(Bring Your Own Embeddings時)textstring? 検索テキスト(Auto Embeddings時)taskTypestring? タスクタイプ(Auto Embeddings時のみ有効、デフォルト: ‘RETRIEVAL_QUERY’) 利用可能な値: RETRIEVAL_QUERY, RETRIEVAL_DOCUMENT, SEMANTIC_SIMILARITY, CLASSIFICATION, CLUSTERING, QUESTION_ANSWERING, FACT_VERIFICATION, CODE_RETRIEVAL_QUERYsearchTextstring? 検索テキスト(全文検索時)searchFieldsArray<string>? 検索対象のデータフィールド名の配列(全文検索時は必須)
DataObject
Section titled “DataObject”Type: Object
Properties
Section titled “Properties”dataObjectIdstring Data Object IDdataObject ユーザーデータvectorsObject<string, VectorValue>? ベクター値createTimestring 作成日時updateTimestring 更新日時
SearchResult
Section titled “SearchResult”Type: Object
Properties
Section titled “Properties”dataObjectDataObject Data Objectdistancenumber 類似度スコア
Data Objectを取得する
Parameters
Section titled “Parameters”Returns Promise<DataObject>
create
Section titled “create”Data Objectを作成する
Parameters
Section titled “Parameters”-
paramObject
Returns Promise<DataObject>
update
Section titled “update”Data Objectを更新する(部分更新)
Parameters
Section titled “Parameters”-
paramObject
Returns Promise<DataObject>
delete
Section titled “delete”Data Objectを削除する
Parameters
Section titled “Parameters”Returns Promise<{}>
Data Objectをクエリする(フィルタ検索)
Parameters
Section titled “Parameters”-
paramObjectparam.collectionIdstring コレクションIDparam.pageSizenumber? 1ページあたりの件数param.pageTokenstring? ページトークンparam.filterObject? フィルタ条件param.outputFieldsOutputFields? 出力フィールド設定
search
Section titled “search”検索を実行する(ベクター検索・セマンティック検索・全文検索)
Parameters
Section titled “Parameters”-
paramObjectparam.collectionIdstring コレクションIDparam.querySearchQuery 検索クエリparam.topKnumber? 取得件数param.filterObject? フィルタ条件param.outputFieldsOutputFields? 出力フィールド設定(デフォルト: 全フィールド)
Returns Promise<{results: Array<SearchResult>}>