milvus-sdk-rust
milvus-sdk-rust copied to clipboard
[Bug]: how get Vec<SearchResult> into value
Is there an existing issue for this?
- [X] I have searched the existing issues
Describe the bug
After obtaining Vec<SearchResult> using search, how can I get the specific data of each field, for example, the specific values of the fields?
Expected Behavior
After obtaining Vec<SearchResult> using search, how can I directly access the specific values of the fields without using match?
Steps/Code To Reproduce behavior
let nomic = OllamaEmbedder::default().with_model("nomic-embed-text");
let vec_content:Vec<f32> = nomic.embed_query(msg).await?.into_iter().map(|x|x as f32).collect();
let collection = client.get_collection("T1").await?;
let result:Vec<SearchResult> = collection.search(vec![Value::FloatArray(Cow::from(vec_content))],"vec2".to_string(),3,MetricType::L2,vec!["pid","content"], &SearchOption::new()).await?;
let j = result.first().unwrap();
for idx in 0..j.size {
let pids = &j.field.get(0).unwrap().get(idx as usize).unwrap();
match pids {
Value::Long(j) => {
println!("{}", j);
},
_ => {}
}
}
Environment details
- Milvus version (v2.3.14):
Anything else?
no