Skip to content

how do i filter a metadata value between a range #31

Pinned Answered by neon-sunset
dansharpe83 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Dan,

Could you try the following snippet?

var priceRange = new MetadataMap
{
    ["price"] = new MetadataMap
    {
        ["$gte"] = 75,
        ["$lte"] = 125
    }
};

Here's the full code to double-check that the query has the desired behavior:

var key = "your-key";
var env = "your-env";

using var pinecone = new PineconeClient(key, env);
using var index = await pinecone.GetIndex(
    (await pinecone.ListIndexes())[0]);

var vec1 = new Vector { Id = "first", Values = new float[1536], Metadata = new() { ["price"] = 50 } };
var vec2 = new Vector { Id = "second", Values = new float[1536], Metadata = new() { ["price"] = 100 } };
var vec3 = new Vector { Id = "third", Values = new float[1536

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by neon-sunset
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants