Skip to content

Implement pagination #1049

@timfdev

Description

@timfdev

Conventional offset pagination as also used by other parts of this repo, won't work here because we use an expensive ranking such as measuring vector distance.

Solution
Use keyset pagination, storing the last (score, entity_id) and user embedded query, this will both prevent an extra embedding inference call as well as ensure stable rankings across pages.
(Embedding inference is not deterministic and the exact same word might yield different vectors)

In the future we probably need to use a snapshot as well, adding an indexed_at field to ensure mutations do not alter the ranking while paginating.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions