Whatever message this page gives is out now! Go check it out!
vectorStoreClient.search(query)Parameter | Type | Required | Description |
query | Struct | Yes | The search query configuration. |
Key | Type | Description |
text | String | The text to search for. (Required if vector is not provided). |
vector | Array | The query embedding vector. (Required if embeddingModel is not configured). |
topK | Numeric | The number of approximate nearest neighbors to return (Overrides client default). |
minScore | Numeric | The minimum similarity score (0.0 to 1.0) required for a result to be included. |
filter | Struct | A metadata filter expression to narrow the search scope. |
<cfscript>
try{
vs = VectorStore({
provider: "inmemory",
embeddingModel: {
"provider": "openai",
"modelName": "text-embedding-3-small",
"apiKey": "#application.apiKey#"
}
});
vs.addAll([
{
"text": "Reset your password from the login screen.",
"metadata": { "department": "accounts", "source": "faq" }
},
{
"text": "Download invoices under Billing.",
"metadata": { "department": "billing", "source": "faq" }
},
{
"text": "API keys are listed under Developer settings.",
"metadata": { "department": "developer", "source": "faq" }
}
]);
hits = vs.search({
"text": "Where is my invoice?",
"topK": 5,
"minScore": 0.3,
"filter": {
"source": "faq",
"$or": [
{ "department": "accounts" },
{ "department": "billing" }
]
}
});
writeDump(hits);
}
catch(any e){
writeOutput("Error initializing VectorStore client:<br><br> ");
writedump(e.detail);
}
</cfscript>