Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Load each node's nearest neighbours among a set of ids, in one statement on every store (port of drivine4j#232)

未关闭
#119 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
neo4j, postgresql, python
领域
backend, databases

调研方向

Start by reading the existing loadNearest implementation and the backend hooks for each store; the issue names no files or tests to begin from. Port the NearestAmongCrossEngineTest dataset and cases from drivine4j, then implement the fragment, view, and Python sync and async forms across the listed stores. Done means the cross-store cases pass, including score parity, ordering, validation, and the documented refusals.

由索引模型根据 Issue 内容生成。

描述

Port of liberation-data/drivine4j#232.

What it does: for each of a set of node ids, return its nearest neighbours among that same set, in one statement on every store. Callers currently write this as an UNWIND over the ids with Neo4j's vector procedure per seed, which runs only on Neo4j.

Shape (drivine4j): loadNearestAmong(graphClass, ids, topK, threshold?, property?, searchK?): Map<id, List<Scored<id>>>.

  • Keys: each id whose node has the embedding, in the order given. Ids are deduplicated; an unknown id, or one with no embedding (or a wrong-size one where the store leaves it out), is not a key.
  • Values: up to topK other ids from the set, never the id itself, most similar first. Each carries the score loadNearest gives that pair on the store. Results below threshold are dropped.
  • searchK: the candidates an approximate index is asked for per seed. It defaults to topK + 1, and a searchK below topK is refused.
  • Refusal: an empty set still validates the class and property before returning {}.
  • Shapes: works on a fragment and on a view; Python sync and async forms (the root fragment's embedding).

Backend hook: nearestAmong(class, property, ids, topK, threshold, searchK), returning one row per seed, {seed, near: [{id, score}]}.

Per store:

Store How
Neo4j UNWIND $ids, match each seed, db.index.vector.queryNodes with the seed's own embedding; always rescore exactly with vector.similarity.*, since the result is always trimmed
FalkorDB the same with db.idx.vector.queryNodes; pass the stored vector as it is, without vecf32(), which takes only a list
Memgraph the same with vector_search.search
Postgres the seeds in a CTE; per seed the pgvector index's nearest joined back to the set, or every same-size seed measured when no index is made
Oracle the seeds in a CTE with ROW_NUMBER; with an index, CROSS APPLY (… FETCH APPROX FIRST searchK) over its side table; with none, every same-size pair measured
Neptune refused, as loadNearest is

The Cypher vector head needs to take its vector from an expression and carry variables through its closing WITH.

Tests to port: drivine4j's NearestAmongCrossEngineTest, with its data set: A, B, C, D in one plane; X outside the set; E with no embedding; Z unknown. It covers:

  • results only from the set, an outsider and the seed absent;
  • the topK cap and the threshold cut;
  • absent keys;
  • scores equal to loadNearest's;
  • a view against its fragment, and naming the property;
  • key order and the searchK shortfall;
  • refusals.
主要语言
Python
星标
1
派生
0
平均合并
1 小时 16 分钟
30 天内合并 PR
74

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

liberation-data/drivine-python 的其他 Issue

查看 liberation-data/drivine-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。