apache / apache/lucene

UnifiedHighlighter: internally visit the query tree once [LUCENE-9277]

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

Description

Ideally the UnifiedHighlighter should "visit" the query tree **once** instead of several times (weight.extractTerms, MultiTermHighlighting, PhraseHelper). Perhaps this can happen in one new class, perhaps called QueryExtractor. It's debatable wether this would replace a bunch of fields presently on UHComponents or whether it would simply help produce the existing UHComponents; shrug.

Admittedly, I don't know how much of an "optimization" this is, or wether this is just a refactoring that is done on principle. I simply like the principle of it; knowing there are multiple _visit_s to the query gnaws at me.

---
Migrated from [LUCENE-9277](https://issues.apache.org/jira/browse/LUCENE-9277) by David Smiley (@dsmiley)

Contributor guide

Open the contributing guide

Research direction

Start by tracing UnifiedHighlighter and UHComponents, then compare the query-tree visits in weight.extractTerms, MultiTermHighlighting, and PhraseHelper. Determine whether a QueryExtractor can unify those visits without changing highlighting behavior; done means the query tree is visited once and the existing UHComponents behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.