Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: how get Vec<SearchResult> into value #87

Open
1 task done
ljjava opened this issue Apr 30, 2024 · 0 comments
Open
1 task done

[Bug]: how get Vec<SearchResult> into value #87

ljjava opened this issue Apr 30, 2024 · 0 comments

Comments

@ljjava
Copy link

ljjava commented Apr 30, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

After obtaining Vec 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 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant