apache / apache/lucene

byte to int in TruncateTokenFilterFactory to TruncateTokenFilter

Open
#12,449 3 comments 0 reactions 0 assignees View on GitHub
type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

TruncateTokenFilterFactory class parses PREFIX_LENGTH_KEY value as Byte which goes upto 127 and then is stored in prefixLength attribute. TruncateTokenFilter class expects the argument in int which has a bigger range than byte. Any value greater than 127 throws a exception while being parsed as Byte in the TruncateTokenFilterFactory class.

I didnt see any documentation in the TruncateTokenFilterFactory class that this value should be less than 128.

### Version and environment details

Lucene 9.7.0 . Also verified in latest main code.

Contributor guide

Open the contributing guide

Research direction

Start with TruncateTokenFilterFactory, where PREFIX_LENGTH_KEY is parsed, and compare its prefixLength handoff with TruncateTokenFilter’s int parameter. Verify that values greater than 127 are accepted without a parsing exception, and check whether the factory documentation needs updating.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.