apache / apache/lucene

Should BaseTokenStreamTestCase catch analyzers that create duplicate tokens? [LUCENE-7622]

Open
#8,673 5 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Major type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

The change to BTSTC is quite simple, to catch any case where the same term text spans from the same position with the same position length. Such duplicate tokens are silly to add to the index, or to search at search time.

Yet, this change produced many failures, and I looked briefly at them, and they are cases that I think are actually OK, e.g. `PatternCaptureGroupTokenFilter` capturing (..)(..) on the string `ktkt` will create a duplicate token.

Other cases looked more dubious, e.g. `WordDelimiterFilter`.

---
Migrated from [LUCENE-7622](https://issues.apache.org/jira/browse/LUCENE-7622) by Michael McCandless (@mikemccand)
Attachments: [LUCENE-7622.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-7622/LUCENE-7622.patch)

Contributor guide

Open the contributing guide

Research direction

Start with BaseTokenStreamTestCase and the proposed duplicate-token check described in the issue. Reproduce and inspect failures involving PatternCaptureGroupTokenFilter and WordDelimiterFilter, using the attached LUCENE-7622.patch as context. Done means the test distinguishes acceptable duplicate tokens from cases that should be rejected.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.