Skip to content

Commit 800c5d0

Browse files
committed
and basic search wrapper
1 parent 7995b06 commit 800c5d0

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/pinecone/data.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ use crate::models::{
1414
SparseValues, UpdateResponse, UpsertResponse, Vector,
1515
};
1616
use crate::openapi::apis::vector_operations_api::UpsertRecordsNamespaceError;
17-
use crate::openapi::apis::ResponseContent;
17+
use crate::openapi::apis::{vector_operations_api, ResponseContent};
18+
use crate::openapi::models::{
19+
SearchRecordsRequest, SearchRecordsRequestQuery, SearchRecordsRequestRerank,
20+
SearchRecordsResponse,
21+
};
1822
use crate::protos;
1923

2024
#[derive(Debug, Clone)]
@@ -168,6 +172,28 @@ impl Index {
168172
}
169173
}
170174

175+
/// TODO
176+
pub async fn search_records(
177+
&mut self,
178+
namespace: &str,
179+
query: SearchRecordsRequestQuery,
180+
fields: Option<Vec<String>>,
181+
rerank: Option<SearchRecordsRequestRerank>,
182+
) -> Result<SearchRecordsResponse, PineconeError> {
183+
let response = vector_operations_api::search_records_namespace(
184+
&self.client.openapi_config,
185+
namespace,
186+
SearchRecordsRequest {
187+
query: Box::new(query),
188+
fields,
189+
rerank: rerank.map(|r| Box::new(r)),
190+
},
191+
)
192+
.await?;
193+
194+
Ok(response)
195+
}
196+
171197
/// The list operation lists the IDs of vectors in a single namespace of a serverless index. An optional prefix can be passed to limit the results to IDs with a common prefix.
172198
///
173199
/// ### Arguments

0 commit comments

Comments
 (0)