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

findOne filtering by $vector returns no results #516

Closed
vkarpov15 opened this issue Aug 26, 2023 · 2 comments · Fixed by #519
Closed

findOne filtering by $vector returns no results #516

vkarpov15 opened this issue Aug 26, 2023 · 2 comments · Fixed by #519
Assignees

Comments

@vkarpov15
Copy link
Collaborator

vkarpov15 commented Aug 26, 2023

The following query returns no results:

{
  "findOne": {
    "filter": {
      "$vector": [
        100,
        1
      ]
    },
    "options": {}
  }
}

But executing the following:

{
  "find": {
    "filter": {}
  }
}

Returns:

[
  {
    _id: new ObjectId("64ea8e193e3aec5cd0b356b2"),
    '$vector': [ 1, 100 ],
    name: 'Test vector 1',
    __v: 0
  },
  {
    _id: new ObjectId("64ea8e193e3aec5cd0b356b3"),
    '$vector': [ 100, 1 ],
    name: 'Test vector 2',
    __v: 0
  }
]

Are you able to query by exact match for $vector?

@tatu-at-datastax
Copy link
Contributor

tatu-at-datastax commented Aug 30, 2023

@vkarpov15 Trying this out with cqlsh I think the answer is "no" -- indexed Vector values can only be used for ANN search:

select * from vector_test where val = [1, 0.1, 0];

InvalidRequest: Error from server: code=2200 [Invalid query] message="Vector indexes only support ANN queries"

But I guess it is odd if we get no error or anything via JSON API.

I will see how this case is currently handled (via ITs) and if no error, whether we could make it fail with expressive error message.

@tatu-at-datastax
Copy link
Contributor

Ok. No failure yet -- will add validation of filter, to give meaningful fail message on attempt to filter on $vector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants