lindaz
lindaz

Reputation: 21

Qdrant + JS / How to return vector embedding?

I am learning Qdrant through this repository: https://github.com/qdrant/qdrant-js/blob/master/examples/node-js-basic/index.js

And I have a problem with the return vector. I am using this code.

const res1 = await client.search(collectionName, {
        vector: queryVector,
        limit: 3,
    });

    console.log('search result: ', res1);
    // prints:
    // search result:  [
    // {
    //     id: 4,
    //     version: 3,
    //     score: 0.99248314,
    //     payload: { city: [Array] },
    //     vector: null
    // },

Even in the documentation, the vector is null. I added an embedding and inserted several records. The similar search is working great, but I am thinking about how to access the embedding that is stored in the vector.

Upvotes: 2

Views: 750

Answers (1)

Tim Visée
Tim Visée

Reputation: 3258

Qdrant does not return stored vectors for retrieval methods by default.

You can enable this with the with_vector parameter.

const res1 = await client.search(collectionName, {
    vector: queryVector,
    limit: 3,
    with_vector: true,
});

Documentation: https://qdrant.tech/documentation/concepts/search/#payload-and-vector-in-the-result

Upvotes: 1

Related Questions