apache / apache/lucene

UnifiedHighlighter cannot handle SpanMultiTermQueryWrapper with an Automaton of type SINGLE [LUCENE-9274]

Open
#10,314 2 comments 0 reactions 0 assignees View on GitHub
affects-version:8.4 legacy-jira-priority:Major type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

MultiTermHighlighting.extractAutomata ignores a Term from a SINGLE Automaton and Highlighting does not work.

Of course an AutomatonQuery with a single term does not make much sense, but it may be generated by an automatic process.

Possible fixes:
- Either implement consumeTerms in MultiTermHighlighting.AutomataCollector
- Or remove special case for SINGLE in CompiledAutomaton.visit

I attatch a Unit Test

---
Migrated from [LUCENE-9274](https://issues.apache.org/jira/browse/LUCENE-9274) by Christoph Goller, updated Mar 12 2020
Attachments: [TestUnifiedHighlighterMTQ.java](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-9274/TestUnifiedHighlighterMTQ.java)

Contributor guide

Open the contributing guide

Research direction

Start by reading MultiTermHighlighting.extractAutomata and its AutomataCollector, then compare the SINGLE handling in CompiledAutomaton.visit. Use the attached TestUnifiedHighlighterMTQ.java as the reproduction and verify that UnifiedHighlighter highlights terms from a SpanMultiTermQueryWrapper using a SINGLE automaton.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.