Phrase queries with a position hole match across adjacent values of a multi-valued field, and trace disagrees

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
18/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust
领域
search

调研方向

Start with phrase_query in src/engine.rs (around lines 2250-2282) to see how query offsets are built when a stop word leaves a hole, and with the trace logic around lines 1837-1881. Tantivy's postings_writer.rs (lines 156-162) explains the cross-value gap. Reproduce with one multi-valued record and the query "alpha the bravo". Done means a maintainer has chosen between changing the index positions and documenting the behavior, and trace agrees with the index for that case.

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

描述

Summary

A phrase query whose analyzed form has a position hole (a removed stop word, and probably a dropped over-long token) can match across two adjacent values of a multi-valued field. traceMatches analyzes each value separately and reports no match, so the record is returned with no highlight.

Found in a review of main at d94fc36. Not documented in the README or docs/limits.md.

Reproduction

Stop words enabled; one record with body: ["zebra alpha", "bravo yak"]; phrase query "alpha the bravo".

Step Result Label
The query compiles to terms at offsets 0 and 2 (the stop word leaves a hole). — verified, src/engine.rs:2250-2282 (phrase_query)
Tantivy places the first token of the next value at last position + 2 (POSITION_GAP = 1). alpha and bravo end up two positions apart verified in Tantivy 0.27.0 postings/postings_writer.rs:156-162
The record is returned as a phrase match. wrong result observed, in a probe against the public Rust API
Trace reports no match with complete: true. hit without highlight observed, same probe; trace side is src/engine.rs:1837-1881
A removed token of 40 bytes or more opens the same hole. — hypothesis; it also advances the position, but was not run
Boolean trace under NOT inverts membership relative to the index for such a record. — hypothesis; no Boolean trace was run

Options

Option Cost
Start each value's token positions at an offset larger than the largest possible phrase gap Changes the persisted postings, so it needs an analyzer identity bump and a rebuild
Keep the index behavior, document it, and make trace mirror the index so hits and highlights agree No rebuild; the cross-value match stays

Expose phrase slop for proximity search #53 would widen the affected set if it ships before this is settled, since slop tolerates larger gaps.

Issue generated by kAIle (Claude Fable 5.2)

主要语言
Rust
星标
3
派生
0
平均合并
20 小时 29 分钟
30 天内合并 PR
13

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

HarperFast/fulltext 的其他 Issue

查看 HarperFast/fulltext 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

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