Skip to content

Bug: find_and_filter_query returns bad matches #1640

Description

@jupyterjazz

Initial Checks

  • I have read and followed the docs and still think this is a bug

Description

_execute_find_and_filter_query is used by two doc indices - in_memory and hnsw

The function sorts documents from lowest to highest based on the score before returning them

docs_sorted = sorted(docs_and_scores, key=lambda x: x[1])

This works for hnsw index, but for in_memory higher scores actually mean better matches. So as a result, we output bad matches first for in_memory index.

Example Code

No response

Python, Pydantic & OS Version

0.33.1

Affected Components

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions