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: In Vectorize filter by metadata keys not working. #2077

Open
PrithivirajDamodaran opened this issue Nov 10, 2023 · 3 comments
Open

Comments

@PrithivirajDamodaran
Copy link

Which Cloudflare product(s) does this pertain to?

Workers for Platforms, Workers Runtime

What version(s) of the tool(s) are you using?

3.15.0

What version of Node are you using?

v18.17.1.

What operating system are you using?

Mac and Linux

Describe the Bug

I am using Vectorize for indexing and querying vectors but it works only query by vectors. But attribute filter is a common for most use-case we should be able to filter by one or more metadata keys and apply query vectors. Thats not working. I cant see any documentation to do the same. Whats the syntax I checked CLIs , JS and API docs none of them seem to show.

In this case query by vectors (on values) and filter by price or description.

{
    id: "97913813",
    values: [0.16, 1.2, 3.8],
    metadata: { "description": "DSLR camera", "price": 13.99$ },
  },

I am sure this feature is included as it is a 1st class feature for DBs, So I assume this to be a omission in the documentation by mistake ?

let queryVector = [54.8, 5.5, 3.1];
let matches = await env.YOUR_INDEX.query(queryVector, { topK: 1, returnValues: true, returnMetadata: true })

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

@PrithivirajDamodaran PrithivirajDamodaran added the bug Something isn't working label Nov 10, 2023
@penalosa penalosa removed the bug Something isn't working label May 1, 2024
@penalosa penalosa transferred this issue from cloudflare/workers-sdk May 1, 2024
@penalosa
Copy link
Collaborator

penalosa commented May 1, 2024

Transferring this to workerd since it's a feature request for the Vectorize JS API cc @vy-ton

@vy-ton
Copy link

vy-ton commented May 10, 2024

@PrithivirajDamodaran You can add a filter property when calling query(), see example here

@andyjessop andyjessop moved this from Untriaged to Other in workers-sdk Jun 10, 2024
@jesper-bylund
Copy link

@vy-ton linked example no longer shows how to use filters. Can't find any such example.

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

No branches or pull requests

4 participants