Skip to content

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

@ljjava

Description

@ljjava

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions