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

Multi Vector > 10000 documents throws scoring error

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

维护者通常 4 天内回复

还没有人认领这个 Issue。

  • #574 来自 @JiwaniZakir —— 已关闭,未合并

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
numpy, python, redis

调研方向

首先使用超过 10,000 个文档,通过 MultiVectorQuery 和 SearchIndex.query 重现该示例,然后跟踪向量分数是如何组装并传递给 RediSearch 的。将失败的情况与 <=10,000 个文档的情况以及引用的 case() workaround 进行比较。当文档数量较大时,查询能够返回结果且不会出现缺失的 distance_1 scoring error,即表示完成。

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

描述

bug query

To reproduce:

from redisvl.query import MultiVectorQuery, Vector

from redisvl.index import SearchIndex
from redisvl.schema import IndexSchema
import numpy as np
from redis import Redis

client = Redis(host="localhost", port=6379, decode_responses=True)

test_index = SearchIndex(
    IndexSchema.from_dict(
        {
            "index": {
                "name": "idx:test",
                "prefix": "test:",
                "storage_type": "json",
            },
            "fields": [
                {"name": "id", "type": "numeric"},
                {
                    "name": "embedding_1",
                    "type": "vector",
                    "attrs": {
                        "dims": 512,
                        "distance_metric": "cosine",
                        "algorithm": "hnsw",
                        "datatype": "float32",
                    },
                },
                {
                    "name": "embedding_2",
                    "type": "vector",
                    "attrs": {
                        "dims": 512,
                        "distance_metric": "cosine",
                        "algorithm": "hnsw",
                        "datatype": "float32",
                    },
                },
            ],
        },
    ),
    client,
    validate_on_load=True,
)

test_index.create(overwrite=True)

TEST_DOCS_COUNT = 10001

test_data = [
    {
        "id": i,
        "embedding_1": np.random.rand(512),
        "embedding_2": np.random.rand(512),
    }
    for i, _ in enumerate(range(TEST_DOCS_COUNT))
]

test_index.load(test_data)

embedding_1 = np.random.rand(512)
embedding_2 = np.random.rand(512)

query_vectors = [
    Vector(
        vector=embedding_1,
        field_name="embedding_1",
        dtype="float32",
        weight=0.7,
    ),
    Vector(
        vector=embedding_2,
        field_name="embedding_2",
        dtype="float32",
        weight=0.2,
    ),
]
query = MultiVectorQuery(
    vectors=query_vectors,
    num_results=10,
    return_fields=["id"],
)

results = test_index.query(query)
print(results)

With a TEST_DOCS_COUNT > 10,000 redis throws:
Error while aggregating: Could not find the value for a parameter name, consider using EXISTS if applicable for distance_1

<=10,000 works fine. I assume this is to do with the same logic that sets the max offset to 10,000 by default.

The workaround I'm using for now is the unstable feature case() to assign defaults for missing scores.

Is RediSearch limited by some design constraint to this number? Seems low for many applications of vector search, or maybe I'm missing something.

主要语言
Python
星标
432
派生
116
平均合并
5 天 22 小时
30 天内合并 PR
13

环境准备

从这里开始

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

redis/redis-vl-python 的其他 Issue

查看 redis/redis-vl-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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