apache / apache/lucene

FilteringTokenFilter should never corrupt the tokenstream graph [LUCENE-4065]

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

Description

Currently removers like stopfilter have an option (true/false) to enable position increments.

If its true: it both inserts gaps where necessary AND propagates gaps down the stream.
If its false: it does neither, which can totally mess up the tokenstream graph (e.g. move synonyms to another word).

There are totally valid natural usecases for false, where you don't want gaps because you want phrasequeries to act as if the word was never actually there.

But 'not inserting gaps' is separate from proper propagation of existing gaps.

So I think we should provide an option (either fix 'false' or make it an enum), where you still get a legit tokenstream and dont totally screw it up, but you simply omit gaps.

See #4921 for more information (Where we at least fixed this case to not begin the tokenstream with posinc=0)

---
Migrated from [LUCENE-4065](https://issues.apache.org/jira/browse/LUCENE-4065) by Robert Muir (@rmuir), 4 votes, updated Feb 23 2018
Attachments: [LUCENE-4065_test.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-4065/LUCENE-4065_test.patch)
Linked issues:
- [SOLR-11968](https://issues.apache.org/jira/browse/SOLR-11968)
- #5706
- [SOLR-8089](https://issues.apache.org/jira/browse/SOLR-8089)

Contributor guide

Open the contributing guide

Research direction

Start by reading the stopfilter behavior described in the issue and inspect the attached LUCENE-4065_test.patch alongside issue #4921. Verify how disabling position increments affects existing gaps and tokenstream graph positions, then confirm that the chosen behavior preserves graph validity while omitting newly inserted gaps.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.