Filter.toString() throws IllegalFormatConversionException for withinGeoRange filters

未关闭 适合新手
#638 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@dudanogueira 已经在做这个了。

开始于 2026年11月10日。

  • #639 来自 @dudanogueira —— 未关闭

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
90/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java
领域
backend

调研方向

Issue 指向 src/main/java/io/weaviate/client6/v1/api/collections/query/Filter.java,具体是约第 966 行的 GeoRangeOperand.toString()。阅读该方法并运行提供的 withinGeoRange 示例,以重现格式异常。按照描述更新 float 格式化,然后确认示例打印筛选器时不会抛出异常。

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

描述

toString() on a withinGeoRange filter throws IllegalFormatConversionException. GeoRangeOperand formats its floats with %d:

https://github.com/weaviate/java-client/blob/ff57caed14df5778ef715132d618383da559c1cc/src/main/java/io/weaviate/client6/v1/api/collections/query/Filter.java#L966

Why it matters

toString() runs implicitly in logging, error messages and test assertions. For example, throw new IllegalStateException("Query failed for " + filter, e) throws IllegalFormatConversionException instead, and the real error is lost. Geo range is the only operand affected. Found while testing the Kestra Weaviate plugin, which supports WITHIN_GEO_RANGE.

Reproduce (client6 6.3.2, no server needed)

import io.weaviate.client6.v1.api.collections.query.Filter;

public class GeoRangeToString {
    public static void main(String[] args) {
        System.out.println(Filter.property("location").withinGeoRange(52.52f, 13.40f, 2000f));
    }
}
Exception in thread "main" java.util.IllegalFormatConversionException: d != java.lang.Float
	...
	at io.weaviate.client6.v1.api.collections.query.Filter$GeoRangeOperand.toString(Filter.java:966)

Fix

return "(lat=%s, lon=%s, distance=%s)".formatted(lat, lon, distance);
主要语言
Java
星标
34
派生
31
平均合并
2 天 10 小时
30 天内合并 PR
2

环境准备

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

从这里开始

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

weaviate/java-client 的其他 Issue

查看 weaviate/java-client 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

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