cloudflare / cloudflare/workerd
🐛 BUG: In Vectorize filter by metadata keys not working.
- Dominant language
- C++
- Stars
- 8.7k
- Forks
- 739
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 174
Description
### 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_
Contributor guide
Research direction
Start at the env.YOUR_INDEX.query entry point and review the Vectorize query documentation, including the JavaScript, CLI, and API references mentioned in the issue. Determine whether filtering by metadata keys is supported and whether the documented syntax matches the reported use case; done when the behavior or the missing documentation is clearly resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100