apache / apache/lucene

FuzzyTermEnums sets negative boost for fuzzy search & highlight [LUCENE-9568]

Open
#10,608 9 comments 0 reactions 0 assignees View on GitHub
affects-version:8.5.1 legacy-jira-label:highlighting legacy-jira-label:newbie legacy-jira-priority:Minor module:highlighter type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

**Description**
When user indexes a word with an apostrophe and constructs a fuzzy query for highlighter, it throws an exception with set negative boost for a query. 

**Repro Steps**
1. Index a text with apostrophe. E.g. doesn't
1. Parse a fuzzy query e.g.: se\~, se\~2, se\~3
1. Try to highlight a text with apostrophe
1. The exception is thrown (for details see attached test test with repro steps)

**Actual Result**
`java.lang.IllegalArgumentException: boost must be a positive float, got -1.0`

**Expected Result**
- No exception.
- Highlighting marks are inserted into a text.

**Workaround**
- not known.

---
Migrated from [LUCENE-9568](https://issues.apache.org/jira/browse/LUCENE-9568) by Juraj Jurčo, 1 vote, updated Oct 14 2020
Attachments: [FindSqlHighlightTest.java](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-9568/FindSqlHighlightTest.java)

Contributor guide

Open the contributing guide

Research direction

Start with the attached FindSqlHighlightTest.java and run its reproduction for an apostrophe-containing term such as "doesn't" with fuzzy queries se\~, se\~2, and se\~3. Trace the fuzzy-query and highlighter path that produces the negative boost exception. Done means the test no longer throws and highlighting marks are inserted into the text.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.